Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241818 views
1
/* Generated by Cython 0.25.2 */
2
3
#define PY_SSIZE_T_CLEAN
4
#include "Python.h"
5
#ifndef Py_PYTHON_H
6
#error Python headers needed to compile C extensions, please install development version of Python.
7
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8
#error Cython requires Python 2.6+ or Python 3.2+.
9
#else
10
#define CYTHON_ABI "0_25_2"
11
#include <stddef.h>
12
#ifndef offsetof
13
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14
#endif
15
#if !defined(WIN32) && !defined(MS_WINDOWS)
16
#ifndef __stdcall
17
#define __stdcall
18
#endif
19
#ifndef __cdecl
20
#define __cdecl
21
#endif
22
#ifndef __fastcall
23
#define __fastcall
24
#endif
25
#endif
26
#ifndef DL_IMPORT
27
#define DL_IMPORT(t) t
28
#endif
29
#ifndef DL_EXPORT
30
#define DL_EXPORT(t) t
31
#endif
32
#ifndef HAVE_LONG_LONG
33
#if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34
#define HAVE_LONG_LONG
35
#endif
36
#endif
37
#ifndef PY_LONG_LONG
38
#define PY_LONG_LONG LONG_LONG
39
#endif
40
#ifndef Py_HUGE_VAL
41
#define Py_HUGE_VAL HUGE_VAL
42
#endif
43
#ifdef PYPY_VERSION
44
#define CYTHON_COMPILING_IN_PYPY 1
45
#define CYTHON_COMPILING_IN_PYSTON 0
46
#define CYTHON_COMPILING_IN_CPYTHON 0
47
#undef CYTHON_USE_TYPE_SLOTS
48
#define CYTHON_USE_TYPE_SLOTS 0
49
#undef CYTHON_USE_ASYNC_SLOTS
50
#define CYTHON_USE_ASYNC_SLOTS 0
51
#undef CYTHON_USE_PYLIST_INTERNALS
52
#define CYTHON_USE_PYLIST_INTERNALS 0
53
#undef CYTHON_USE_UNICODE_INTERNALS
54
#define CYTHON_USE_UNICODE_INTERNALS 0
55
#undef CYTHON_USE_UNICODE_WRITER
56
#define CYTHON_USE_UNICODE_WRITER 0
57
#undef CYTHON_USE_PYLONG_INTERNALS
58
#define CYTHON_USE_PYLONG_INTERNALS 0
59
#undef CYTHON_AVOID_BORROWED_REFS
60
#define CYTHON_AVOID_BORROWED_REFS 1
61
#undef CYTHON_ASSUME_SAFE_MACROS
62
#define CYTHON_ASSUME_SAFE_MACROS 0
63
#undef CYTHON_UNPACK_METHODS
64
#define CYTHON_UNPACK_METHODS 0
65
#undef CYTHON_FAST_THREAD_STATE
66
#define CYTHON_FAST_THREAD_STATE 0
67
#undef CYTHON_FAST_PYCALL
68
#define CYTHON_FAST_PYCALL 0
69
#elif defined(PYSTON_VERSION)
70
#define CYTHON_COMPILING_IN_PYPY 0
71
#define CYTHON_COMPILING_IN_PYSTON 1
72
#define CYTHON_COMPILING_IN_CPYTHON 0
73
#ifndef CYTHON_USE_TYPE_SLOTS
74
#define CYTHON_USE_TYPE_SLOTS 1
75
#endif
76
#undef CYTHON_USE_ASYNC_SLOTS
77
#define CYTHON_USE_ASYNC_SLOTS 0
78
#undef CYTHON_USE_PYLIST_INTERNALS
79
#define CYTHON_USE_PYLIST_INTERNALS 0
80
#ifndef CYTHON_USE_UNICODE_INTERNALS
81
#define CYTHON_USE_UNICODE_INTERNALS 1
82
#endif
83
#undef CYTHON_USE_UNICODE_WRITER
84
#define CYTHON_USE_UNICODE_WRITER 0
85
#undef CYTHON_USE_PYLONG_INTERNALS
86
#define CYTHON_USE_PYLONG_INTERNALS 0
87
#ifndef CYTHON_AVOID_BORROWED_REFS
88
#define CYTHON_AVOID_BORROWED_REFS 0
89
#endif
90
#ifndef CYTHON_ASSUME_SAFE_MACROS
91
#define CYTHON_ASSUME_SAFE_MACROS 1
92
#endif
93
#ifndef CYTHON_UNPACK_METHODS
94
#define CYTHON_UNPACK_METHODS 1
95
#endif
96
#undef CYTHON_FAST_THREAD_STATE
97
#define CYTHON_FAST_THREAD_STATE 0
98
#undef CYTHON_FAST_PYCALL
99
#define CYTHON_FAST_PYCALL 0
100
#else
101
#define CYTHON_COMPILING_IN_PYPY 0
102
#define CYTHON_COMPILING_IN_PYSTON 0
103
#define CYTHON_COMPILING_IN_CPYTHON 1
104
#ifndef CYTHON_USE_TYPE_SLOTS
105
#define CYTHON_USE_TYPE_SLOTS 1
106
#endif
107
#if PY_MAJOR_VERSION < 3
108
#undef CYTHON_USE_ASYNC_SLOTS
109
#define CYTHON_USE_ASYNC_SLOTS 0
110
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
111
#define CYTHON_USE_ASYNC_SLOTS 1
112
#endif
113
#if PY_VERSION_HEX < 0x02070000
114
#undef CYTHON_USE_PYLONG_INTERNALS
115
#define CYTHON_USE_PYLONG_INTERNALS 0
116
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
117
#define CYTHON_USE_PYLONG_INTERNALS 1
118
#endif
119
#ifndef CYTHON_USE_PYLIST_INTERNALS
120
#define CYTHON_USE_PYLIST_INTERNALS 1
121
#endif
122
#ifndef CYTHON_USE_UNICODE_INTERNALS
123
#define CYTHON_USE_UNICODE_INTERNALS 1
124
#endif
125
#if PY_VERSION_HEX < 0x030300F0
126
#undef CYTHON_USE_UNICODE_WRITER
127
#define CYTHON_USE_UNICODE_WRITER 0
128
#elif !defined(CYTHON_USE_UNICODE_WRITER)
129
#define CYTHON_USE_UNICODE_WRITER 1
130
#endif
131
#ifndef CYTHON_AVOID_BORROWED_REFS
132
#define CYTHON_AVOID_BORROWED_REFS 0
133
#endif
134
#ifndef CYTHON_ASSUME_SAFE_MACROS
135
#define CYTHON_ASSUME_SAFE_MACROS 1
136
#endif
137
#ifndef CYTHON_UNPACK_METHODS
138
#define CYTHON_UNPACK_METHODS 1
139
#endif
140
#ifndef CYTHON_FAST_THREAD_STATE
141
#define CYTHON_FAST_THREAD_STATE 1
142
#endif
143
#ifndef CYTHON_FAST_PYCALL
144
#define CYTHON_FAST_PYCALL 1
145
#endif
146
#endif
147
#if !defined(CYTHON_FAST_PYCCALL)
148
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
149
#endif
150
#if CYTHON_USE_PYLONG_INTERNALS
151
#include "longintrepr.h"
152
#undef SHIFT
153
#undef BASE
154
#undef MASK
155
#endif
156
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157
#define Py_OptimizeFlag 0
158
#endif
159
#define __PYX_BUILD_PY_SSIZE_T "n"
160
#define CYTHON_FORMAT_SSIZE_T "z"
161
#if PY_MAJOR_VERSION < 3
162
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
163
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
164
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
165
#define __Pyx_DefaultClassType PyClass_Type
166
#else
167
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
168
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
169
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
170
#define __Pyx_DefaultClassType PyType_Type
171
#endif
172
#ifndef Py_TPFLAGS_CHECKTYPES
173
#define Py_TPFLAGS_CHECKTYPES 0
174
#endif
175
#ifndef Py_TPFLAGS_HAVE_INDEX
176
#define Py_TPFLAGS_HAVE_INDEX 0
177
#endif
178
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
180
#endif
181
#ifndef Py_TPFLAGS_HAVE_FINALIZE
182
#define Py_TPFLAGS_HAVE_FINALIZE 0
183
#endif
184
#ifndef METH_FASTCALL
185
#define METH_FASTCALL 0x80
186
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
187
Py_ssize_t nargs, PyObject *kwnames);
188
#else
189
#define __Pyx_PyCFunctionFast _PyCFunctionFast
190
#endif
191
#if CYTHON_FAST_PYCCALL
192
#define __Pyx_PyFastCFunction_Check(func)\
193
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
194
#else
195
#define __Pyx_PyFastCFunction_Check(func) 0
196
#endif
197
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
198
#define CYTHON_PEP393_ENABLED 1
199
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
200
0 : _PyUnicode_Ready((PyObject *)(op)))
201
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
202
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
203
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
204
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
205
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
206
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
207
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
208
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
209
#else
210
#define CYTHON_PEP393_ENABLED 0
211
#define PyUnicode_1BYTE_KIND 1
212
#define PyUnicode_2BYTE_KIND 2
213
#define PyUnicode_4BYTE_KIND 4
214
#define __Pyx_PyUnicode_READY(op) (0)
215
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
216
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
217
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
218
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
219
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
220
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
221
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
222
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
223
#endif
224
#if CYTHON_COMPILING_IN_PYPY
225
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
226
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
227
#else
228
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
229
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
230
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
231
#endif
232
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
234
#endif
235
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
237
#endif
238
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
240
#endif
241
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
242
#define PyObject_Malloc(s) PyMem_Malloc(s)
243
#define PyObject_Free(p) PyMem_Free(p)
244
#define PyObject_Realloc(p) PyMem_Realloc(p)
245
#endif
246
#if CYTHON_COMPILING_IN_PYSTON
247
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
248
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
249
#else
250
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
251
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
252
#endif
253
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
254
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
255
#if PY_MAJOR_VERSION >= 3
256
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
257
#else
258
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
259
#endif
260
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261
#define PyObject_ASCII(o) PyObject_Repr(o)
262
#endif
263
#if PY_MAJOR_VERSION >= 3
264
#define PyBaseString_Type PyUnicode_Type
265
#define PyStringObject PyUnicodeObject
266
#define PyString_Type PyUnicode_Type
267
#define PyString_Check PyUnicode_Check
268
#define PyString_CheckExact PyUnicode_CheckExact
269
#endif
270
#if PY_MAJOR_VERSION >= 3
271
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
273
#else
274
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
276
#endif
277
#ifndef PySet_CheckExact
278
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
279
#endif
280
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
281
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
282
#if PY_MAJOR_VERSION >= 3
283
#define PyIntObject PyLongObject
284
#define PyInt_Type PyLong_Type
285
#define PyInt_Check(op) PyLong_Check(op)
286
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
287
#define PyInt_FromString PyLong_FromString
288
#define PyInt_FromUnicode PyLong_FromUnicode
289
#define PyInt_FromLong PyLong_FromLong
290
#define PyInt_FromSize_t PyLong_FromSize_t
291
#define PyInt_FromSsize_t PyLong_FromSsize_t
292
#define PyInt_AsLong PyLong_AsLong
293
#define PyInt_AS_LONG PyLong_AS_LONG
294
#define PyInt_AsSsize_t PyLong_AsSsize_t
295
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
296
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
297
#define PyNumber_Int PyNumber_Long
298
#endif
299
#if PY_MAJOR_VERSION >= 3
300
#define PyBoolObject PyLongObject
301
#endif
302
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303
#ifndef PyUnicode_InternFromString
304
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
305
#endif
306
#endif
307
#if PY_VERSION_HEX < 0x030200A4
308
typedef long Py_hash_t;
309
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
310
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
311
#else
312
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
314
#endif
315
#if PY_MAJOR_VERSION >= 3
316
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
317
#else
318
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
319
#endif
320
#if CYTHON_USE_ASYNC_SLOTS
321
#if PY_VERSION_HEX >= 0x030500B1
322
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
323
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
324
#else
325
typedef struct {
326
unaryfunc am_await;
327
unaryfunc am_aiter;
328
unaryfunc am_anext;
329
} __Pyx_PyAsyncMethodsStruct;
330
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
331
#endif
332
#else
333
#define __Pyx_PyType_AsAsync(obj) NULL
334
#endif
335
#ifndef CYTHON_RESTRICT
336
#if defined(__GNUC__)
337
#define CYTHON_RESTRICT __restrict__
338
#elif defined(_MSC_VER) && _MSC_VER >= 1400
339
#define CYTHON_RESTRICT __restrict
340
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341
#define CYTHON_RESTRICT restrict
342
#else
343
#define CYTHON_RESTRICT
344
#endif
345
#endif
346
#ifndef CYTHON_UNUSED
347
# if defined(__GNUC__)
348
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
349
# define CYTHON_UNUSED __attribute__ ((__unused__))
350
# else
351
# define CYTHON_UNUSED
352
# endif
353
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354
# define CYTHON_UNUSED __attribute__ ((__unused__))
355
# else
356
# define CYTHON_UNUSED
357
# endif
358
#endif
359
#ifndef CYTHON_MAYBE_UNUSED_VAR
360
# if defined(__cplusplus)
361
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
362
# else
363
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
364
# endif
365
#endif
366
#ifndef CYTHON_NCP_UNUSED
367
# if CYTHON_COMPILING_IN_CPYTHON
368
# define CYTHON_NCP_UNUSED
369
# else
370
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
371
# endif
372
#endif
373
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
374
375
#ifndef CYTHON_INLINE
376
#if defined(__clang__)
377
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
378
#elif defined(__GNUC__)
379
#define CYTHON_INLINE __inline__
380
#elif defined(_MSC_VER)
381
#define CYTHON_INLINE __inline
382
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
383
#define CYTHON_INLINE inline
384
#else
385
#define CYTHON_INLINE
386
#endif
387
#endif
388
389
#if defined(WIN32) || defined(MS_WINDOWS)
390
#define _USE_MATH_DEFINES
391
#endif
392
#include <math.h>
393
#ifdef NAN
394
#define __PYX_NAN() ((float) NAN)
395
#else
396
static CYTHON_INLINE float __PYX_NAN() {
397
float value;
398
memset(&value, 0xFF, sizeof(value));
399
return value;
400
}
401
#endif
402
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403
#define __Pyx_truncl trunc
404
#else
405
#define __Pyx_truncl truncl
406
#endif
407
408
409
#define __PYX_ERR(f_index, lineno, Ln_error) \
410
{ \
411
__pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
412
}
413
414
#if PY_MAJOR_VERSION >= 3
415
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
416
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
417
#else
418
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
419
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
420
#endif
421
422
#ifndef __PYX_EXTERN_C
423
#ifdef __cplusplus
424
#define __PYX_EXTERN_C extern "C"
425
#else
426
#define __PYX_EXTERN_C extern
427
#endif
428
#endif
429
430
#define __PYX_HAVE__code__alex__psage__psage__ellcurve__lseries__aplist_sqrt5
431
#define __PYX_HAVE_API__code__alex__psage__psage__ellcurve__lseries__aplist_sqrt5
432
#include <string.h>
433
#include <stdio.h>
434
#include "gmp.h"
435
#include <stdint.h>
436
#include "sage/libs/ntl/ntlwrap.h"
437
#include "pythread.h"
438
#include "sage/misc/cython_metaclass.h"
439
#ifdef _OPENMP
440
#include <omp.h>
441
#endif /* _OPENMP */
442
443
#ifdef PYREX_WITHOUT_ASSERTIONS
444
#define CYTHON_WITHOUT_ASSERTIONS
445
#endif
446
447
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
448
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
449
450
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
451
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
452
#define __PYX_DEFAULT_STRING_ENCODING ""
453
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
454
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
455
#define __Pyx_uchar_cast(c) ((unsigned char)c)
456
#define __Pyx_long_cast(x) ((long)x)
457
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
458
(sizeof(type) < sizeof(Py_ssize_t)) ||\
459
(sizeof(type) > sizeof(Py_ssize_t) &&\
460
likely(v < (type)PY_SSIZE_T_MAX ||\
461
v == (type)PY_SSIZE_T_MAX) &&\
462
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
463
v == (type)PY_SSIZE_T_MIN))) ||\
464
(sizeof(type) == sizeof(Py_ssize_t) &&\
465
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
466
v == (type)PY_SSIZE_T_MAX))) )
467
#if defined (__cplusplus) && __cplusplus >= 201103L
468
#include <cstdlib>
469
#define __Pyx_sst_abs(value) std::abs(value)
470
#elif SIZEOF_INT >= SIZEOF_SIZE_T
471
#define __Pyx_sst_abs(value) abs(value)
472
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
473
#define __Pyx_sst_abs(value) labs(value)
474
#elif defined (_MSC_VER) && defined (_M_X64)
475
#define __Pyx_sst_abs(value) _abs64(value)
476
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
477
#define __Pyx_sst_abs(value) llabs(value)
478
#elif defined (__GNUC__)
479
#define __Pyx_sst_abs(value) __builtin_llabs(value)
480
#else
481
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
482
#endif
483
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
484
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
485
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
486
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
487
#define __Pyx_PyBytes_FromString PyBytes_FromString
488
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
489
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
490
#if PY_MAJOR_VERSION < 3
491
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
492
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
493
#else
494
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
495
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
496
#endif
497
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
498
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
499
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
500
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
501
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
502
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
503
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
504
#if PY_MAJOR_VERSION < 3
505
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
506
{
507
const Py_UNICODE *u_end = u;
508
while (*u_end++) ;
509
return (size_t)(u_end - u - 1);
510
}
511
#else
512
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
513
#endif
514
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
515
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
516
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
517
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
518
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
519
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
520
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
521
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
522
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
523
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
524
#if CYTHON_ASSUME_SAFE_MACROS
525
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
526
#else
527
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
528
#endif
529
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
530
#if PY_MAJOR_VERSION >= 3
531
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
532
#else
533
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
534
#endif
535
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
536
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
537
static int __Pyx_sys_getdefaultencoding_not_ascii;
538
static int __Pyx_init_sys_getdefaultencoding_params(void) {
539
PyObject* sys;
540
PyObject* default_encoding = NULL;
541
PyObject* ascii_chars_u = NULL;
542
PyObject* ascii_chars_b = NULL;
543
const char* default_encoding_c;
544
sys = PyImport_ImportModule("sys");
545
if (!sys) goto bad;
546
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
547
Py_DECREF(sys);
548
if (!default_encoding) goto bad;
549
default_encoding_c = PyBytes_AsString(default_encoding);
550
if (!default_encoding_c) goto bad;
551
if (strcmp(default_encoding_c, "ascii") == 0) {
552
__Pyx_sys_getdefaultencoding_not_ascii = 0;
553
} else {
554
char ascii_chars[128];
555
int c;
556
for (c = 0; c < 128; c++) {
557
ascii_chars[c] = c;
558
}
559
__Pyx_sys_getdefaultencoding_not_ascii = 1;
560
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
561
if (!ascii_chars_u) goto bad;
562
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
563
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
564
PyErr_Format(
565
PyExc_ValueError,
566
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
567
default_encoding_c);
568
goto bad;
569
}
570
Py_DECREF(ascii_chars_u);
571
Py_DECREF(ascii_chars_b);
572
}
573
Py_DECREF(default_encoding);
574
return 0;
575
bad:
576
Py_XDECREF(default_encoding);
577
Py_XDECREF(ascii_chars_u);
578
Py_XDECREF(ascii_chars_b);
579
return -1;
580
}
581
#endif
582
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
583
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
584
#else
585
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
586
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
587
static char* __PYX_DEFAULT_STRING_ENCODING;
588
static int __Pyx_init_sys_getdefaultencoding_params(void) {
589
PyObject* sys;
590
PyObject* default_encoding = NULL;
591
char* default_encoding_c;
592
sys = PyImport_ImportModule("sys");
593
if (!sys) goto bad;
594
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
595
Py_DECREF(sys);
596
if (!default_encoding) goto bad;
597
default_encoding_c = PyBytes_AsString(default_encoding);
598
if (!default_encoding_c) goto bad;
599
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
600
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
601
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
602
Py_DECREF(default_encoding);
603
return 0;
604
bad:
605
Py_XDECREF(default_encoding);
606
return -1;
607
}
608
#endif
609
#endif
610
611
612
/* Test for GCC > 2.95 */
613
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
614
#define likely(x) __builtin_expect(!!(x), 1)
615
#define unlikely(x) __builtin_expect(!!(x), 0)
616
#else /* !__GNUC__ or GCC < 2.95 */
617
#define likely(x) (x)
618
#define unlikely(x) (x)
619
#endif /* __GNUC__ */
620
621
static PyObject *__pyx_m;
622
static PyObject *__pyx_d;
623
static PyObject *__pyx_b;
624
static PyObject *__pyx_empty_tuple;
625
static PyObject *__pyx_empty_bytes;
626
static PyObject *__pyx_empty_unicode;
627
static int __pyx_lineno;
628
static int __pyx_clineno = 0;
629
static const char * __pyx_cfilenm= __FILE__;
630
static const char *__pyx_filename;
631
632
633
static const char *__pyx_f[] = {
634
"code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx",
635
"element.pxd",
636
"sage_object.pxd",
637
"code/alex/psage/psage/ellcurve/lseries/stringsource",
638
"type.pxd",
639
"bool.pxd",
640
"complex.pxd",
641
"category_object.pxd",
642
"coerce_dict.pxd",
643
"inherit_comparison.pxd",
644
"parent.pxd",
645
"map.pxd",
646
"morphism.pxd",
647
"integer.pxd",
648
"parent_old.pxd",
649
"parent_base.pxd",
650
"parent_gens.pxd",
651
"ring.pxd",
652
"binary_tree.pxd",
653
"polynomial_compiled.pxd",
654
"polynomial_element.pxd",
655
"ntl_ZZX.pxd",
656
"ntl_ZZ.pxd",
657
"number_field_element.pxd",
658
"number_field_element_quadratic.pxd",
659
"code/alex/psage/psage/modform/hilbert/sqrt5/sqrt5_fast.pxd",
660
"code/alex/psage/psage/number_fields/sqrt5/prime.pxd",
661
};
662
663
/*--- Type declarations ---*/
664
struct __pyx_obj_4sage_9structure_11sage_object_SageObject;
665
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject;
666
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict;
667
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict;
668
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass;
669
struct __pyx_obj_4sage_9structure_6parent_Parent;
670
struct __pyx_obj_4sage_9structure_7element_Element;
671
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod;
672
struct __pyx_obj_4sage_9structure_7element_ModuleElement;
673
struct __pyx_obj_4sage_9structure_7element_MonoidElement;
674
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement;
675
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement;
676
struct __pyx_obj_4sage_9structure_7element_RingElement;
677
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement;
678
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement;
679
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement;
680
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement;
681
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement;
682
struct __pyx_obj_4sage_9structure_7element_FieldElement;
683
struct __pyx_obj_4sage_9structure_7element_AlgebraElement;
684
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement;
685
struct __pyx_obj_4sage_9structure_7element_InfinityElement;
686
struct __pyx_obj_4sage_9structure_7element_Vector;
687
struct __pyx_obj_4sage_9structure_7element_Matrix;
688
struct __pyx_obj_4sage_9structure_7element_CoercionModel;
689
struct __pyx_obj_4sage_10categories_3map_Map;
690
struct __pyx_obj_4sage_10categories_3map_Section;
691
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap;
692
struct __pyx_obj_4sage_10categories_8morphism_Morphism;
693
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism;
694
struct __pyx_obj_4sage_5rings_7integer_Integer;
695
struct __pyx_obj_4sage_5rings_7integer_int_to_Z;
696
struct __pyx_obj_4sage_9structure_10parent_old_Parent;
697
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase;
698
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens;
699
struct __pyx_obj_4sage_5rings_4ring_Ring;
700
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing;
701
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain;
702
struct __pyx_obj_4sage_5rings_4ring_DedekindDomain;
703
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain;
704
struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain;
705
struct __pyx_obj_4sage_5rings_4ring_Field;
706
struct __pyx_obj_4sage_5rings_4ring_Algebra;
707
struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra;
708
struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree;
709
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction;
710
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd;
711
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd;
712
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd;
713
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd;
714
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd;
715
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd;
716
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd;
717
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd;
718
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd;
719
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd;
720
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd;
721
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd;
722
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial;
723
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense;
724
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact;
725
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX;
726
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ;
727
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement;
728
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute;
729
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative;
730
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute;
731
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative;
732
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic;
733
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic;
734
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract;
735
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement;
736
struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime;
737
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py;
738
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce;
739
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action;
740
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action;
741
742
/* "parent.pxd":102
743
*
744
* # Flags for Parent.flags
745
* cdef enum: # <<<<<<<<<<<<<<
746
* # If this flag is set, call __richcmp__ on elements without
747
* # coercion. This allows a completely custom comparison function.
748
*/
749
enum {
750
__pyx_e_4sage_9structure_6parent_Parent_richcmp_element_without_coercion = 1
751
};
752
753
/* "parent.pxd":38
754
*
755
* # Called from the __init__ method to set up coercion.
756
* cdef int init_coerce(self, bint warn=*) except -1 # <<<<<<<<<<<<<<
757
*
758
* # returns whether or not there is a Morphism from S to self
759
*/
760
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce {
761
int __pyx_n;
762
int warn;
763
};
764
765
/* "parent.pxd":55
766
* # returns the Action by/on self on/by S
767
* # corresponding to op and self_on_left
768
* cpdef get_action(self, S, op=*, bint self_on_left=*, self_el=*, S_el=*) # <<<<<<<<<<<<<<
769
* cpdef _get_action_(self, S, op, bint self_on_left)
770
*
771
*/
772
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action {
773
int __pyx_n;
774
PyObject *op;
775
int self_on_left;
776
PyObject *self_el;
777
PyObject *S_el;
778
};
779
780
/* "parent.pxd":68
781
* cdef discover_coerce_map_from(self, S)
782
* cdef discover_convert_map_from(self, S)
783
* cdef discover_action(self, S, op, bint self_on_left, self_el=*, S_el=*) # <<<<<<<<<<<<<<
784
*
785
* # List consisting of Morphisms (from anything to self)
786
*/
787
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action {
788
int __pyx_n;
789
PyObject *self_el;
790
PyObject *S_el;
791
};
792
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args;
793
794
/* "map.pxd":15
795
* # these methods require x is an element of domain, and returns an element with parent codomain
796
* cpdef Element _call_(self, x)
797
* cpdef Element _call_with_args(self, x, args=*, kwds=*) # <<<<<<<<<<<<<<
798
*
799
* cdef public domain # will be either a weakref or a constant map
800
*/
801
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args {
802
int __pyx_n;
803
PyObject *args;
804
PyObject *kwds;
805
};
806
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node;
807
808
/* "sage/misc/binary_tree.pxd":1
809
* cdef struct binary_tree_node: # <<<<<<<<<<<<<<
810
* int key
811
* binary_tree_node *left
812
*/
813
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node {
814
int key;
815
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *left;
816
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *right;
817
void *value;
818
};
819
820
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":5
821
*
822
* # Residue element
823
* ctypedef long residue_element[2] # <<<<<<<<<<<<<<
824
*
825
* cdef class ResidueRingElement
826
*/
827
typedef long __pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element[2];
828
829
/* "sage_object.pxd":9
830
*
831
*
832
* cdef class SageObject: # <<<<<<<<<<<<<<
833
* pass
834
*
835
*/
836
struct __pyx_obj_4sage_9structure_11sage_object_SageObject {
837
PyObject_HEAD
838
};
839
840
841
/* "sage/structure/category_object.pxd":15
842
* cpdef check_default_category(default_category, category)
843
*
844
* cdef class CategoryObject(SageObject): # <<<<<<<<<<<<<<
845
* cdef public dict __cached_methods
846
* cdef _category
847
*/
848
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject {
849
struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
850
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtab;
851
PyObject *__cached_methods;
852
PyObject *_category;
853
PyObject *_base;
854
PyObject *_names;
855
PyObject *_factory_data;
856
PyObject *__weakref__;
857
long _hash_value;
858
};
859
860
861
/* "sage/structure/coerce_dict.pxd":7
862
*
863
* @cython.final
864
* cdef class MonoDict: # <<<<<<<<<<<<<<
865
* cdef __weakref__
866
* cdef size_t mask
867
*/
868
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict {
869
PyObject_HEAD
870
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtab;
871
PyObject *__weakref__;
872
size_t mask;
873
size_t used;
874
size_t fill;
875
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *table;
876
int weak_values;
877
PyObject *eraser;
878
};
879
880
881
/* "sage/structure/coerce_dict.pxd":23
882
*
883
* @cython.final
884
* cdef class TripleDict: # <<<<<<<<<<<<<<
885
* cdef __weakref__
886
* cdef size_t mask
887
*/
888
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict {
889
PyObject_HEAD
890
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtab;
891
PyObject *__weakref__;
892
size_t mask;
893
size_t used;
894
size_t fill;
895
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *table;
896
int weak_values;
897
PyObject *eraser;
898
};
899
900
901
/* "sage/misc/inherit_comparison.pxd":3
902
* cimport sage.misc.cython_metaclass
903
*
904
* cdef class InheritComparisonMetaclass(type): # <<<<<<<<<<<<<<
905
* pass
906
*/
907
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass {
908
PyHeapTypeObject __pyx_base;
909
};
910
911
912
/* "parent.pxd":12
913
* from sage.structure.coerce_dict cimport MonoDict, TripleDict
914
*
915
* cdef class Parent(category_object.CategoryObject): # <<<<<<<<<<<<<<
916
* cdef public _element_constructor
917
* cdef public _convert_method_name
918
*/
919
struct __pyx_obj_4sage_9structure_6parent_Parent {
920
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject __pyx_base;
921
PyObject *_element_constructor;
922
PyObject *_convert_method_name;
923
int _element_init_pass_parent;
924
PyObject *_initial_coerce_list;
925
PyObject *_initial_action_list;
926
PyObject *_initial_convert_list;
927
int _coercions_used;
928
int flags;
929
PyObject *_cache_an_element;
930
PyObject *_coerce_from_list;
931
PyObject *_registered_domains;
932
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_coerce_from_hash;
933
PyObject *_action_list;
934
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *_action_hash;
935
PyObject *_convert_from_list;
936
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_convert_from_hash;
937
PyObject *_embedding;
938
};
939
940
941
/* "sage/structure/element.pxd":169
942
*
943
*
944
* cdef class Element(SageObject): # <<<<<<<<<<<<<<
945
* cdef Parent _parent
946
* cpdef _richcmp_(left, right, int op)
947
*/
948
struct __pyx_obj_4sage_9structure_7element_Element {
949
struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
950
struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtab;
951
struct __pyx_obj_4sage_9structure_6parent_Parent *_parent;
952
};
953
954
955
/* "sage/structure/element.pxd":192
956
*
957
*
958
* cdef class ElementWithCachedMethod(Element): # <<<<<<<<<<<<<<
959
* cdef public dict __cached_methods
960
*
961
*/
962
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod {
963
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
964
PyObject *__cached_methods;
965
};
966
967
968
/* "sage/structure/element.pxd":195
969
* cdef public dict __cached_methods
970
*
971
* cdef class ModuleElement(Element) # forward declaration # <<<<<<<<<<<<<<
972
*
973
* cdef class RingElement(ModuleElement) # forward declaration
974
*/
975
struct __pyx_obj_4sage_9structure_7element_ModuleElement {
976
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
977
};
978
979
980
/* "sage/structure/element.pxd":208
981
* cpdef _rmul_(self, RingElement left)
982
*
983
* cdef class MonoidElement(Element): # <<<<<<<<<<<<<<
984
* pass
985
*
986
*/
987
struct __pyx_obj_4sage_9structure_7element_MonoidElement {
988
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
989
};
990
991
992
/* "sage/structure/element.pxd":211
993
* pass
994
*
995
* cdef class MultiplicativeGroupElement(MonoidElement): # <<<<<<<<<<<<<<
996
* cpdef _div_(self, right)
997
*
998
*/
999
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement {
1000
struct __pyx_obj_4sage_9structure_7element_MonoidElement __pyx_base;
1001
};
1002
1003
1004
/* "sage/structure/element.pxd":214
1005
* cpdef _div_(self, right)
1006
*
1007
* cdef class AdditiveGroupElement(ModuleElement): # <<<<<<<<<<<<<<
1008
* pass
1009
*
1010
*/
1011
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement {
1012
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1013
};
1014
1015
1016
/* "sage/structure/element.pxd":197
1017
* cdef class ModuleElement(Element) # forward declaration
1018
*
1019
* cdef class RingElement(ModuleElement) # forward declaration # <<<<<<<<<<<<<<
1020
*
1021
* cdef class ModuleElement(Element):
1022
*/
1023
struct __pyx_obj_4sage_9structure_7element_RingElement {
1024
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1025
};
1026
1027
1028
/* "sage/structure/element.pxd":220
1029
* cpdef _div_(self, right)
1030
*
1031
* cdef class CommutativeRingElement(RingElement): # <<<<<<<<<<<<<<
1032
* pass
1033
*
1034
*/
1035
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement {
1036
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1037
};
1038
1039
1040
/* "sage/structure/element.pxd":223
1041
* pass
1042
*
1043
* cdef class IntegralDomainElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1044
* pass
1045
*
1046
*/
1047
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement {
1048
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1049
};
1050
1051
1052
/* "sage/structure/element.pxd":226
1053
* pass
1054
*
1055
* cdef class DedekindDomainElement(IntegralDomainElement): # <<<<<<<<<<<<<<
1056
* pass
1057
*
1058
*/
1059
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement {
1060
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement __pyx_base;
1061
};
1062
1063
1064
/* "sage/structure/element.pxd":229
1065
* pass
1066
*
1067
* cdef class PrincipalIdealDomainElement(DedekindDomainElement): # <<<<<<<<<<<<<<
1068
* pass
1069
*
1070
*/
1071
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement {
1072
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement __pyx_base;
1073
};
1074
1075
1076
/* "sage/structure/element.pxd":232
1077
* pass
1078
*
1079
* cdef class EuclideanDomainElement(PrincipalIdealDomainElement): # <<<<<<<<<<<<<<
1080
* cpdef _floordiv_(self, right)
1081
* cpdef _mod_(self, right)
1082
*/
1083
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement {
1084
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
1085
};
1086
1087
1088
/* "sage/structure/element.pxd":236
1089
* cpdef _mod_(self, right)
1090
*
1091
* cdef class FieldElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1092
* cpdef _floordiv_(self, right)
1093
*
1094
*/
1095
struct __pyx_obj_4sage_9structure_7element_FieldElement {
1096
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1097
};
1098
1099
1100
/* "sage/structure/element.pxd":239
1101
* cpdef _floordiv_(self, right)
1102
*
1103
* cdef class AlgebraElement(RingElement): # <<<<<<<<<<<<<<
1104
* pass
1105
*
1106
*/
1107
struct __pyx_obj_4sage_9structure_7element_AlgebraElement {
1108
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1109
};
1110
1111
1112
/* "sage/structure/element.pxd":242
1113
* pass
1114
*
1115
* cdef class CommutativeAlgebraElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1116
* pass
1117
*
1118
*/
1119
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement {
1120
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1121
};
1122
1123
1124
/* "sage/structure/element.pxd":245
1125
* pass
1126
*
1127
* cdef class InfinityElement(RingElement): # <<<<<<<<<<<<<<
1128
* pass
1129
*
1130
*/
1131
struct __pyx_obj_4sage_9structure_7element_InfinityElement {
1132
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1133
};
1134
1135
1136
/* "sage/structure/element.pxd":249
1137
*
1138
*
1139
* cdef class Vector(ModuleElement): # <<<<<<<<<<<<<<
1140
* cdef Py_ssize_t _degree
1141
*
1142
*/
1143
struct __pyx_obj_4sage_9structure_7element_Vector {
1144
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1145
Py_ssize_t _degree;
1146
};
1147
1148
1149
/* "sage/structure/element.pxd":264
1150
*
1151
*
1152
* cdef class Matrix(ModuleElement): # <<<<<<<<<<<<<<
1153
* # All matrix classes must be written in Cython
1154
* cdef Py_ssize_t _nrows
1155
*/
1156
struct __pyx_obj_4sage_9structure_7element_Matrix {
1157
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1158
Py_ssize_t _nrows;
1159
Py_ssize_t _ncols;
1160
};
1161
1162
1163
/* "sage/structure/element.pxd":277
1164
*
1165
*
1166
* cdef class CoercionModel: # <<<<<<<<<<<<<<
1167
* cpdef canonical_coercion(self, x, y)
1168
* cpdef bin_op(self, x, y, op)
1169
*/
1170
struct __pyx_obj_4sage_9structure_7element_CoercionModel {
1171
PyObject_HEAD
1172
struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel *__pyx_vtab;
1173
};
1174
1175
1176
/* "map.pxd":4
1177
* from sage.structure.element cimport Element
1178
*
1179
* cdef class Map(Element): # <<<<<<<<<<<<<<
1180
* cdef object __weakref__
1181
*
1182
*/
1183
struct __pyx_obj_4sage_10categories_3map_Map {
1184
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
1185
PyObject *__weakref__;
1186
int _coerce_cost;
1187
PyObject *domain;
1188
PyObject *codomain;
1189
struct __pyx_obj_4sage_9structure_6parent_Parent *_codomain;
1190
PyObject *_category_for;
1191
PyObject *_repr_type_str;
1192
};
1193
1194
1195
/* "map.pxd":25
1196
*
1197
*
1198
* cdef class Section(Map): # <<<<<<<<<<<<<<
1199
* cdef Map _inverse
1200
*
1201
*/
1202
struct __pyx_obj_4sage_10categories_3map_Section {
1203
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1204
struct __pyx_obj_4sage_10categories_3map_Map *_inverse;
1205
};
1206
1207
1208
/* "map.pxd":28
1209
* cdef Map _inverse
1210
*
1211
* cdef class FormalCompositeMap(Map): # <<<<<<<<<<<<<<
1212
* cdef __list
1213
*/
1214
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap {
1215
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1216
PyObject *__pyx___list;
1217
};
1218
1219
1220
/* "sage/categories/morphism.pxd":5
1221
* from .map cimport Map
1222
*
1223
* cdef class Morphism(Map): # <<<<<<<<<<<<<<
1224
* pass
1225
*
1226
*/
1227
struct __pyx_obj_4sage_10categories_8morphism_Morphism {
1228
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1229
};
1230
1231
1232
/* "sage/categories/morphism.pxd":8
1233
* pass
1234
*
1235
* cdef class SetMorphism(Morphism): # <<<<<<<<<<<<<<
1236
* cdef object _function
1237
* cpdef bint _eq_c_impl(left, Element right)
1238
*/
1239
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism {
1240
struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
1241
PyObject *_function;
1242
};
1243
1244
1245
/* "sage/rings/integer.pxd":7
1246
* from sage.categories.morphism cimport Morphism
1247
*
1248
* cdef class Integer(EuclideanDomainElement): # <<<<<<<<<<<<<<
1249
* cdef mpz_t value
1250
*
1251
*/
1252
struct __pyx_obj_4sage_5rings_7integer_Integer {
1253
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
1254
mpz_t value;
1255
};
1256
1257
1258
/* "sage/rings/integer.pxd":37
1259
* cdef Integer smallInteger(long value)
1260
*
1261
* cdef class int_to_Z(Morphism): # <<<<<<<<<<<<<<
1262
* pass
1263
*/
1264
struct __pyx_obj_4sage_5rings_7integer_int_to_Z {
1265
struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
1266
};
1267
1268
1269
/* "parent_old.pxd":15
1270
*
1271
*
1272
* cdef class Parent(parent.Parent): # <<<<<<<<<<<<<<
1273
*
1274
* # returns a Morphism from S to self, or None
1275
*/
1276
struct __pyx_obj_4sage_9structure_10parent_old_Parent {
1277
struct __pyx_obj_4sage_9structure_6parent_Parent __pyx_base;
1278
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_has_coerce_map_from;
1279
};
1280
1281
1282
/* "parent_base.pxd":11
1283
* from .parent_old cimport Parent as Parent_old
1284
*
1285
* cdef class ParentWithBase(Parent_old): # <<<<<<<<<<<<<<
1286
* pass
1287
*/
1288
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase {
1289
struct __pyx_obj_4sage_9structure_10parent_old_Parent __pyx_base;
1290
};
1291
1292
1293
/* "sage/structure/parent_gens.pxd":18
1294
*
1295
*
1296
* cdef class ParentWithGens(ParentWithBase): # <<<<<<<<<<<<<<
1297
* cdef public object _gens
1298
* cdef public object _latex_names
1299
*/
1300
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens {
1301
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase __pyx_base;
1302
PyObject *_gens;
1303
PyObject *_latex_names;
1304
PyObject *_list;
1305
};
1306
1307
1308
/* "sage/rings/ring.pxd":5
1309
* cpdef bint _is_Field(x) except -2
1310
*
1311
* cdef class Ring(ParentWithGens): # <<<<<<<<<<<<<<
1312
* cdef public object _zero_element
1313
* cdef public object _one_element
1314
*/
1315
struct __pyx_obj_4sage_5rings_4ring_Ring {
1316
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens __pyx_base;
1317
PyObject *_zero_element;
1318
PyObject *_one_element;
1319
PyObject *_zero_ideal;
1320
PyObject *_unit_ideal;
1321
PyObject *__ideal_monoid;
1322
};
1323
1324
1325
/* "sage/rings/ring.pxd":13
1326
* cdef _an_element_c_impl(self)
1327
*
1328
* cdef class CommutativeRing(Ring): # <<<<<<<<<<<<<<
1329
* cdef public object __fraction_field
1330
*
1331
*/
1332
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing {
1333
struct __pyx_obj_4sage_5rings_4ring_Ring __pyx_base;
1334
PyObject *__fraction_field;
1335
};
1336
1337
1338
/* "sage/rings/ring.pxd":16
1339
* cdef public object __fraction_field
1340
*
1341
* cdef class IntegralDomain(CommutativeRing): # <<<<<<<<<<<<<<
1342
* pass
1343
*
1344
*/
1345
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain {
1346
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
1347
};
1348
1349
1350
/* "sage/rings/ring.pxd":19
1351
* pass
1352
*
1353
* cdef class DedekindDomain(IntegralDomain): # <<<<<<<<<<<<<<
1354
* pass
1355
*
1356
*/
1357
struct __pyx_obj_4sage_5rings_4ring_DedekindDomain {
1358
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain __pyx_base;
1359
};
1360
1361
1362
/* "sage/rings/ring.pxd":23
1363
*
1364
*
1365
* cdef class PrincipalIdealDomain(IntegralDomain): # <<<<<<<<<<<<<<
1366
* pass
1367
*
1368
*/
1369
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain {
1370
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain __pyx_base;
1371
};
1372
1373
1374
/* "sage/rings/ring.pxd":26
1375
* pass
1376
*
1377
* cdef class EuclideanDomain(PrincipalIdealDomain): # <<<<<<<<<<<<<<
1378
* pass
1379
*
1380
*/
1381
struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain {
1382
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
1383
};
1384
1385
1386
/* "sage/rings/ring.pxd":29
1387
* pass
1388
*
1389
* cdef class Field(PrincipalIdealDomain): # <<<<<<<<<<<<<<
1390
* pass
1391
*
1392
*/
1393
struct __pyx_obj_4sage_5rings_4ring_Field {
1394
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
1395
};
1396
1397
1398
/* "sage/rings/ring.pxd":32
1399
* pass
1400
*
1401
* cdef class Algebra(Ring): # <<<<<<<<<<<<<<
1402
* pass
1403
*
1404
*/
1405
struct __pyx_obj_4sage_5rings_4ring_Algebra {
1406
struct __pyx_obj_4sage_5rings_4ring_Ring __pyx_base;
1407
};
1408
1409
1410
/* "sage/rings/ring.pxd":35
1411
* pass
1412
*
1413
* cdef class CommutativeAlgebra(CommutativeRing): # <<<<<<<<<<<<<<
1414
* pass
1415
*/
1416
struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra {
1417
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
1418
};
1419
1420
1421
/* "sage/misc/binary_tree.pxd":27
1422
*
1423
*
1424
* cdef class BinaryTree: # <<<<<<<<<<<<<<
1425
* cdef binary_tree_node *head
1426
*/
1427
struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree {
1428
PyObject_HEAD
1429
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *head;
1430
};
1431
1432
1433
/* "polynomial_compiled.pxd":7
1434
* cdef class generic_pd
1435
*
1436
* cdef class CompiledPolynomialFunction: # <<<<<<<<<<<<<<
1437
* cdef generic_pd _dag
1438
* cdef object _coeffs
1439
*/
1440
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction {
1441
PyObject_HEAD
1442
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *__pyx_vtab;
1443
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *_dag;
1444
PyObject *_coeffs;
1445
};
1446
1447
1448
/* "polynomial_compiled.pxd":5
1449
*
1450
*
1451
* cdef class generic_pd # <<<<<<<<<<<<<<
1452
*
1453
* cdef class CompiledPolynomialFunction:
1454
*/
1455
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd {
1456
PyObject_HEAD
1457
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *__pyx_vtab;
1458
PyObject *value;
1459
int refs;
1460
int hits;
1461
int label;
1462
};
1463
1464
1465
/* "polynomial_compiled.pxd":24
1466
* cdef void reset(self)
1467
*
1468
* cdef class dummy_pd(generic_pd): # <<<<<<<<<<<<<<
1469
* cdef generic_pd link
1470
* cdef void fill(dummy_pd self, generic_pd link)
1471
*/
1472
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd {
1473
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1474
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *link;
1475
};
1476
1477
1478
/* "polynomial_compiled.pxd":28
1479
* cdef void fill(dummy_pd self, generic_pd link)
1480
*
1481
* cdef class var_pd(generic_pd): # <<<<<<<<<<<<<<
1482
* cdef int index
1483
*
1484
*/
1485
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd {
1486
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1487
int index;
1488
};
1489
1490
1491
/* "polynomial_compiled.pxd":31
1492
* cdef int index
1493
*
1494
* cdef class univar_pd(generic_pd): # <<<<<<<<<<<<<<
1495
* pass
1496
*
1497
*/
1498
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd {
1499
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1500
};
1501
1502
1503
/* "polynomial_compiled.pxd":34
1504
* pass
1505
*
1506
* cdef class coeff_pd(generic_pd): # <<<<<<<<<<<<<<
1507
* cdef int index
1508
*
1509
*/
1510
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd {
1511
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1512
int index;
1513
};
1514
1515
1516
/* "polynomial_compiled.pxd":38
1517
*
1518
*
1519
* cdef class unary_pd(generic_pd): # <<<<<<<<<<<<<<
1520
* cdef generic_pd operand
1521
*
1522
*/
1523
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd {
1524
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1525
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *operand;
1526
};
1527
1528
1529
/* "polynomial_compiled.pxd":41
1530
* cdef generic_pd operand
1531
*
1532
* cdef class sqr_pd(unary_pd): # <<<<<<<<<<<<<<
1533
* pass
1534
*
1535
*/
1536
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd {
1537
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
1538
};
1539
1540
1541
/* "polynomial_compiled.pxd":44
1542
* pass
1543
*
1544
* cdef class pow_pd(unary_pd): # <<<<<<<<<<<<<<
1545
* cdef object exponent
1546
*
1547
*/
1548
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd {
1549
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
1550
PyObject *exponent;
1551
};
1552
1553
1554
/* "polynomial_compiled.pxd":48
1555
*
1556
*
1557
* cdef class binary_pd(generic_pd): # <<<<<<<<<<<<<<
1558
* cdef generic_pd left, right
1559
*
1560
*/
1561
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd {
1562
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1563
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *left;
1564
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *right;
1565
};
1566
1567
1568
/* "polynomial_compiled.pxd":51
1569
* cdef generic_pd left, right
1570
*
1571
* cdef class add_pd(binary_pd): # <<<<<<<<<<<<<<
1572
* pass
1573
*
1574
*/
1575
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd {
1576
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
1577
};
1578
1579
1580
/* "polynomial_compiled.pxd":54
1581
* pass
1582
*
1583
* cdef class mul_pd(binary_pd): # <<<<<<<<<<<<<<
1584
* pass
1585
*
1586
*/
1587
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd {
1588
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
1589
};
1590
1591
1592
/* "polynomial_compiled.pxd":57
1593
* pass
1594
*
1595
* cdef class abc_pd(binary_pd): # <<<<<<<<<<<<<<
1596
* cdef int index
1597
*
1598
*/
1599
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd {
1600
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
1601
int index;
1602
};
1603
1604
1605
/* "sage/rings/polynomial/polynomial_element.pxd":8
1606
*
1607
*
1608
* cdef class Polynomial(CommutativeAlgebraElement): # <<<<<<<<<<<<<<
1609
* cdef char _is_gen
1610
* cdef CompiledPolynomialFunction _compiled
1611
*/
1612
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial {
1613
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement __pyx_base;
1614
char _is_gen;
1615
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *_compiled;
1616
};
1617
1618
1619
/* "sage/rings/polynomial/polynomial_element.pxd":29
1620
* cdef get_unsafe(self, Py_ssize_t i)
1621
*
1622
* cdef class Polynomial_generic_dense(Polynomial): # <<<<<<<<<<<<<<
1623
* cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P)
1624
* cdef list __coeffs
1625
*/
1626
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense {
1627
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial __pyx_base;
1628
PyObject *__pyx___coeffs;
1629
};
1630
1631
1632
/* "sage/rings/polynomial/polynomial_element.pxd":34
1633
* cdef int __normalize(self) except -1
1634
*
1635
* cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense): # <<<<<<<<<<<<<<
1636
* pass
1637
*
1638
*/
1639
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact {
1640
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense __pyx_base;
1641
};
1642
1643
1644
/* "sage/libs/ntl/ntl_ZZX.pxd":3
1645
* from .types cimport ZZX_c
1646
*
1647
* cdef class ntl_ZZX(object): # <<<<<<<<<<<<<<
1648
* cdef ZZX_c x
1649
* cdef void setitem_from_int(ntl_ZZX self, long i, int value)
1650
*/
1651
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX {
1652
PyObject_HEAD
1653
struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx_vtab;
1654
ZZX x;
1655
};
1656
1657
1658
/* "sage/libs/ntl/ntl_ZZ.pxd":3
1659
* from sage.libs.ntl.types cimport ZZ_c
1660
*
1661
* cdef class ntl_ZZ(object): # <<<<<<<<<<<<<<
1662
* cdef ZZ_c x
1663
* cdef int get_as_int(ntl_ZZ self)
1664
*/
1665
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ {
1666
PyObject_HEAD
1667
struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx_vtab;
1668
ZZ x;
1669
};
1670
1671
1672
/* "number_field_element.pxd":11
1673
* from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
1674
*
1675
* cdef class NumberFieldElement(FieldElement): # <<<<<<<<<<<<<<
1676
* cdef ZZX_c __numerator
1677
* cdef ZZ_c __denominator
1678
*/
1679
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement {
1680
struct __pyx_obj_4sage_9structure_7element_FieldElement __pyx_base;
1681
ZZX __pyx___numerator;
1682
ZZ __pyx___denominator;
1683
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx___fld_numerator;
1684
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx___fld_denominator;
1685
PyObject *__pyx___multiplicative_order;
1686
PyObject *__pyx___pari;
1687
PyObject *__pyx___matrix;
1688
};
1689
1690
1691
/* "number_field_element.pxd":38
1692
*
1693
*
1694
* cdef class NumberFieldElement_absolute(NumberFieldElement): # <<<<<<<<<<<<<<
1695
* pass
1696
*
1697
*/
1698
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute {
1699
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
1700
};
1701
1702
1703
/* "number_field_element.pxd":41
1704
* pass
1705
*
1706
* cdef class NumberFieldElement_relative(NumberFieldElement): # <<<<<<<<<<<<<<
1707
* pass
1708
*
1709
*/
1710
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative {
1711
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
1712
};
1713
1714
1715
/* "number_field_element.pxd":46
1716
* # TODO: cyclotomic and/or quadratic classes? (Both for differing implementations and speed).
1717
*
1718
* cdef class OrderElement_absolute(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
1719
* cdef object _number_field
1720
*
1721
*/
1722
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute {
1723
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
1724
PyObject *_number_field;
1725
};
1726
1727
1728
/* "number_field_element.pxd":49
1729
* cdef object _number_field
1730
*
1731
* cdef class OrderElement_relative(NumberFieldElement_relative): # <<<<<<<<<<<<<<
1732
* cdef object _number_field
1733
*/
1734
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative {
1735
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative __pyx_base;
1736
PyObject *_number_field;
1737
};
1738
1739
1740
/* "sage/rings/number_field/number_field_element_quadratic.pxd":6
1741
*
1742
*
1743
* cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
1744
* # (a + b sqrt(D)) / denom
1745
* cdef mpz_t a, b, denom
1746
*/
1747
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic {
1748
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
1749
mpz_t a;
1750
mpz_t b;
1751
mpz_t denom;
1752
struct __pyx_obj_4sage_5rings_7integer_Integer *D;
1753
int standard_embedding;
1754
};
1755
1756
1757
/* "sage/rings/number_field/number_field_element_quadratic.pxd":19
1758
*
1759
*
1760
* cdef class OrderElement_quadratic(NumberFieldElement_quadratic): # <<<<<<<<<<<<<<
1761
* pass
1762
*/
1763
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic {
1764
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic __pyx_base;
1765
};
1766
1767
1768
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":9
1769
* cdef class ResidueRingElement
1770
*
1771
* cdef class ResidueRing_abstract(CommutativeRing): # <<<<<<<<<<<<<<
1772
* cdef object P, F
1773
* cdef public object element_class, _residue_field
1774
*/
1775
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract {
1776
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
1777
PyObject *P;
1778
PyObject *F;
1779
PyObject *element_class;
1780
PyObject *_residue_field;
1781
long n0;
1782
long n1;
1783
long p;
1784
long e;
1785
long _cardinality;
1786
long im_gen0;
1787
};
1788
1789
1790
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":7
1791
* ctypedef long residue_element[2]
1792
*
1793
* cdef class ResidueRingElement # <<<<<<<<<<<<<<
1794
*
1795
* cdef class ResidueRing_abstract(CommutativeRing):
1796
*/
1797
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement {
1798
PyObject_HEAD
1799
struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_vtab;
1800
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element x;
1801
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *_parent;
1802
};
1803
1804
1805
/* "psage/number_fields/sqrt5/prime.pxd":22
1806
* #################################################################################
1807
*
1808
* cdef class Prime: # <<<<<<<<<<<<<<
1809
* cdef public long p, r
1810
* cdef bint first
1811
*/
1812
struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime {
1813
PyObject_HEAD
1814
struct __pyx_vtabstruct_5psage_13number_fields_5sqrt5_5prime_Prime *__pyx_vtab;
1815
long p;
1816
long r;
1817
int first;
1818
};
1819
1820
1821
/* "cfunc.to_py":64
1822
*
1823
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
1824
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
1825
* def wrap(object arg0, object arg1, int arg2):
1826
* """wrap(arg0, arg1, arg2: 'int')"""
1827
*/
1828
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py {
1829
PyObject_HEAD
1830
PyObject *(*__pyx_v_f)(PyObject *, PyObject *, int);
1831
};
1832
1833
1834
1835
/* "sage/structure/category_object.pxd":15
1836
* cpdef check_default_category(default_category, category)
1837
*
1838
* cdef class CategoryObject(SageObject): # <<<<<<<<<<<<<<
1839
* cdef public dict __cached_methods
1840
* cdef _category
1841
*/
1842
1843
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject {
1844
PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject *, PyObject *);
1845
};
1846
static struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject;
1847
1848
1849
/* "sage/structure/coerce_dict.pxd":7
1850
*
1851
* @cython.final
1852
* cdef class MonoDict: # <<<<<<<<<<<<<<
1853
* cdef __weakref__
1854
* cdef size_t mask
1855
*/
1856
1857
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict {
1858
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
1859
PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
1860
PyObject *(*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *, PyObject *);
1861
int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *);
1862
};
1863
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict;
1864
1865
1866
/* "sage/structure/coerce_dict.pxd":23
1867
*
1868
* @cython.final
1869
* cdef class TripleDict: # <<<<<<<<<<<<<<
1870
* cdef __weakref__
1871
* cdef size_t mask
1872
*/
1873
1874
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict {
1875
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
1876
PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
1877
PyObject *(*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *, PyObject *);
1878
int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *);
1879
};
1880
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict;
1881
1882
1883
/* "parent.pxd":12
1884
* from sage.structure.coerce_dict cimport MonoDict, TripleDict
1885
*
1886
* cdef class Parent(category_object.CategoryObject): # <<<<<<<<<<<<<<
1887
* cdef public _element_constructor
1888
* cdef public _convert_method_name
1889
*/
1890
1891
struct __pyx_vtabstruct_4sage_9structure_6parent_Parent {
1892
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject __pyx_base;
1893
int (*get_flag)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
1894
int (*is_coercion_cached)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1895
int (*is_conversion_cached)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1896
PyObject *(*register_coercion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1897
PyObject *(*register_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1898
PyObject *(*register_conversion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1899
PyObject *(*register_embedding)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1900
int (*_richcmp)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int, int __pyx_skip_dispatch);
1901
int (*_cmp_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1902
int (*is_exact)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
1903
int (*init_coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce *__pyx_optional_args);
1904
int (*has_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1905
PyObject *(*coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1906
PyObject *(*_internal_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1907
PyObject *(*_coerce_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1908
PyObject *(*convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1909
PyObject *(*_internal_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1910
PyObject *(*_convert_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1911
PyObject *(*get_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action *__pyx_optional_args);
1912
PyObject *(*_get_action_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
1913
PyObject *(*coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1914
PyObject *(*an_element)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
1915
PyObject *(*_generic_convert_map)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1916
PyObject *(*discover_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
1917
PyObject *(*discover_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
1918
PyObject *(*discover_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action *__pyx_optional_args);
1919
};
1920
static struct __pyx_vtabstruct_4sage_9structure_6parent_Parent *__pyx_vtabptr_4sage_9structure_6parent_Parent;
1921
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
1922
1923
1924
/* "sage/structure/element.pxd":169
1925
*
1926
*
1927
* cdef class Element(SageObject): # <<<<<<<<<<<<<<
1928
* cdef Parent _parent
1929
* cpdef _richcmp_(left, right, int op)
1930
*/
1931
1932
struct __pyx_vtabstruct_4sage_9structure_7element_Element {
1933
PyObject *(*_richcmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1934
int (*_cmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
1935
PyObject *(*base_extend)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
1936
PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1937
PyObject *(*_act_on_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1938
PyObject *(*_acted_upon_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1939
PyObject *(*_add_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1940
PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1941
PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_Element *);
1942
PyObject *(*_add_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
1943
PyObject *(*_mul_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1944
PyObject *(*_mul_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
1945
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1946
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1947
PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1948
};
1949
static struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtabptr_4sage_9structure_7element_Element;
1950
1951
1952
/* "sage/structure/element.pxd":192
1953
*
1954
*
1955
* cdef class ElementWithCachedMethod(Element): # <<<<<<<<<<<<<<
1956
* cdef public dict __cached_methods
1957
*
1958
*/
1959
1960
struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod {
1961
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1962
};
1963
static struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod *__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod;
1964
1965
1966
/* "sage/structure/element.pxd":195
1967
* cdef public dict __cached_methods
1968
*
1969
* cdef class ModuleElement(Element) # forward declaration # <<<<<<<<<<<<<<
1970
*
1971
* cdef class RingElement(ModuleElement) # forward declaration
1972
*/
1973
1974
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement {
1975
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1976
PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, PyObject *, int __pyx_skip_dispatch);
1977
PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, int __pyx_skip_dispatch);
1978
PyObject *(*_lmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_RingElement *, int __pyx_skip_dispatch);
1979
PyObject *(*_rmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_RingElement *, int __pyx_skip_dispatch);
1980
};
1981
static struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement *__pyx_vtabptr_4sage_9structure_7element_ModuleElement;
1982
1983
1984
/* "sage/structure/element.pxd":197
1985
* cdef class ModuleElement(Element) # forward declaration
1986
*
1987
* cdef class RingElement(ModuleElement) # forward declaration # <<<<<<<<<<<<<<
1988
*
1989
* cdef class ModuleElement(Element):
1990
*/
1991
1992
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement {
1993
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
1994
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_RingElement *, PyObject *, int __pyx_skip_dispatch);
1995
};
1996
static struct __pyx_vtabstruct_4sage_9structure_7element_RingElement *__pyx_vtabptr_4sage_9structure_7element_RingElement;
1997
1998
1999
/* "sage/structure/element.pxd":208
2000
* cpdef _rmul_(self, RingElement left)
2001
*
2002
* cdef class MonoidElement(Element): # <<<<<<<<<<<<<<
2003
* pass
2004
*
2005
*/
2006
2007
struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement {
2008
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
2009
};
2010
static struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement *__pyx_vtabptr_4sage_9structure_7element_MonoidElement;
2011
2012
2013
/* "sage/structure/element.pxd":211
2014
* pass
2015
*
2016
* cdef class MultiplicativeGroupElement(MonoidElement): # <<<<<<<<<<<<<<
2017
* cpdef _div_(self, right)
2018
*
2019
*/
2020
2021
struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement {
2022
struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement __pyx_base;
2023
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement *, PyObject *, int __pyx_skip_dispatch);
2024
};
2025
static struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement *__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement;
2026
2027
2028
/* "sage/structure/element.pxd":214
2029
* cpdef _div_(self, right)
2030
*
2031
* cdef class AdditiveGroupElement(ModuleElement): # <<<<<<<<<<<<<<
2032
* pass
2033
*
2034
*/
2035
2036
struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement {
2037
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2038
};
2039
static struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement *__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement;
2040
2041
2042
/* "sage/structure/element.pxd":220
2043
* cpdef _div_(self, right)
2044
*
2045
* cdef class CommutativeRingElement(RingElement): # <<<<<<<<<<<<<<
2046
* pass
2047
*
2048
*/
2049
2050
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement {
2051
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
2052
};
2053
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement;
2054
2055
2056
/* "sage/structure/element.pxd":223
2057
* pass
2058
*
2059
* cdef class IntegralDomainElement(CommutativeRingElement): # <<<<<<<<<<<<<<
2060
* pass
2061
*
2062
*/
2063
2064
struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement {
2065
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
2066
};
2067
static struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement *__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement;
2068
2069
2070
/* "sage/structure/element.pxd":226
2071
* pass
2072
*
2073
* cdef class DedekindDomainElement(IntegralDomainElement): # <<<<<<<<<<<<<<
2074
* pass
2075
*
2076
*/
2077
2078
struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement {
2079
struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement __pyx_base;
2080
};
2081
static struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement *__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement;
2082
2083
2084
/* "sage/structure/element.pxd":229
2085
* pass
2086
*
2087
* cdef class PrincipalIdealDomainElement(DedekindDomainElement): # <<<<<<<<<<<<<<
2088
* pass
2089
*
2090
*/
2091
2092
struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement {
2093
struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement __pyx_base;
2094
};
2095
static struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement *__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement;
2096
2097
2098
/* "sage/structure/element.pxd":232
2099
* pass
2100
*
2101
* cdef class EuclideanDomainElement(PrincipalIdealDomainElement): # <<<<<<<<<<<<<<
2102
* cpdef _floordiv_(self, right)
2103
* cpdef _mod_(self, right)
2104
*/
2105
2106
struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement {
2107
struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
2108
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
2109
PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
2110
};
2111
static struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement *__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement;
2112
2113
2114
/* "sage/structure/element.pxd":236
2115
* cpdef _mod_(self, right)
2116
*
2117
* cdef class FieldElement(CommutativeRingElement): # <<<<<<<<<<<<<<
2118
* cpdef _floordiv_(self, right)
2119
*
2120
*/
2121
2122
struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement {
2123
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
2124
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_FieldElement *, PyObject *, int __pyx_skip_dispatch);
2125
};
2126
static struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement *__pyx_vtabptr_4sage_9structure_7element_FieldElement;
2127
2128
2129
/* "sage/structure/element.pxd":239
2130
* cpdef _floordiv_(self, right)
2131
*
2132
* cdef class AlgebraElement(RingElement): # <<<<<<<<<<<<<<
2133
* pass
2134
*
2135
*/
2136
2137
struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement {
2138
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
2139
};
2140
static struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement *__pyx_vtabptr_4sage_9structure_7element_AlgebraElement;
2141
2142
2143
/* "sage/structure/element.pxd":242
2144
* pass
2145
*
2146
* cdef class CommutativeAlgebraElement(CommutativeRingElement): # <<<<<<<<<<<<<<
2147
* pass
2148
*
2149
*/
2150
2151
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement {
2152
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
2153
};
2154
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement;
2155
2156
2157
/* "sage/structure/element.pxd":245
2158
* pass
2159
*
2160
* cdef class InfinityElement(RingElement): # <<<<<<<<<<<<<<
2161
* pass
2162
*
2163
*/
2164
2165
struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement {
2166
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
2167
};
2168
static struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement *__pyx_vtabptr_4sage_9structure_7element_InfinityElement;
2169
2170
2171
/* "sage/structure/element.pxd":249
2172
*
2173
*
2174
* cdef class Vector(ModuleElement): # <<<<<<<<<<<<<<
2175
* cdef Py_ssize_t _degree
2176
*
2177
*/
2178
2179
struct __pyx_vtabstruct_4sage_9structure_7element_Vector {
2180
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2181
PyObject *(*_dot_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
2182
PyObject *(*_dot_product_coerce_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
2183
PyObject *(*_pairwise_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
2184
int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
2185
int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
2186
};
2187
static struct __pyx_vtabstruct_4sage_9structure_7element_Vector *__pyx_vtabptr_4sage_9structure_7element_Vector;
2188
2189
2190
/* "sage/structure/element.pxd":264
2191
*
2192
*
2193
* cdef class Matrix(ModuleElement): # <<<<<<<<<<<<<<
2194
* # All matrix classes must be written in Cython
2195
* cdef Py_ssize_t _nrows
2196
*/
2197
2198
struct __pyx_vtabstruct_4sage_9structure_7element_Matrix {
2199
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2200
PyObject *(*_vector_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
2201
PyObject *(*_matrix_times_vector_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
2202
PyObject *(*_matrix_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Matrix *);
2203
int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
2204
int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
2205
};
2206
static struct __pyx_vtabstruct_4sage_9structure_7element_Matrix *__pyx_vtabptr_4sage_9structure_7element_Matrix;
2207
2208
2209
/* "sage/structure/element.pxd":277
2210
*
2211
*
2212
* cdef class CoercionModel: # <<<<<<<<<<<<<<
2213
* cpdef canonical_coercion(self, x, y)
2214
* cpdef bin_op(self, x, y, op)
2215
*/
2216
2217
struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel {
2218
PyObject *(*canonical_coercion)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, int __pyx_skip_dispatch);
2219
PyObject *(*bin_op)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
2220
PyObject *(*richcmp)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
2221
};
2222
static struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel *__pyx_vtabptr_4sage_9structure_7element_CoercionModel;
2223
2224
2225
/* "map.pxd":4
2226
* from sage.structure.element cimport Element
2227
*
2228
* cdef class Map(Element): # <<<<<<<<<<<<<<
2229
* cdef object __weakref__
2230
*
2231
*/
2232
2233
struct __pyx_vtabstruct_4sage_10categories_3map_Map {
2234
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
2235
PyObject *(*_update_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
2236
PyObject *(*_extra_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
2237
struct __pyx_obj_4sage_9structure_7element_Element *(*_call_)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch);
2238
struct __pyx_obj_4sage_9structure_7element_Element *(*_call_with_args)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args *__pyx_optional_args);
2239
};
2240
static struct __pyx_vtabstruct_4sage_10categories_3map_Map *__pyx_vtabptr_4sage_10categories_3map_Map;
2241
2242
2243
/* "map.pxd":25
2244
*
2245
*
2246
* cdef class Section(Map): # <<<<<<<<<<<<<<
2247
* cdef Map _inverse
2248
*
2249
*/
2250
2251
struct __pyx_vtabstruct_4sage_10categories_3map_Section {
2252
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
2253
};
2254
static struct __pyx_vtabstruct_4sage_10categories_3map_Section *__pyx_vtabptr_4sage_10categories_3map_Section;
2255
2256
2257
/* "map.pxd":28
2258
* cdef Map _inverse
2259
*
2260
* cdef class FormalCompositeMap(Map): # <<<<<<<<<<<<<<
2261
* cdef __list
2262
*/
2263
2264
struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap {
2265
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
2266
};
2267
static struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap *__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap;
2268
2269
2270
/* "sage/categories/morphism.pxd":5
2271
* from .map cimport Map
2272
*
2273
* cdef class Morphism(Map): # <<<<<<<<<<<<<<
2274
* pass
2275
*
2276
*/
2277
2278
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism {
2279
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
2280
};
2281
static struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism *__pyx_vtabptr_4sage_10categories_8morphism_Morphism;
2282
2283
2284
/* "sage/categories/morphism.pxd":8
2285
* pass
2286
*
2287
* cdef class SetMorphism(Morphism): # <<<<<<<<<<<<<<
2288
* cdef object _function
2289
* cpdef bint _eq_c_impl(left, Element right)
2290
*/
2291
2292
struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism {
2293
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
2294
int (*_eq_c_impl)(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism *, struct __pyx_obj_4sage_9structure_7element_Element *, int __pyx_skip_dispatch);
2295
};
2296
static struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism *__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism;
2297
2298
2299
/* "sage/rings/integer.pxd":7
2300
* from sage.categories.morphism cimport Morphism
2301
*
2302
* cdef class Integer(EuclideanDomainElement): # <<<<<<<<<<<<<<
2303
* cdef mpz_t value
2304
*
2305
*/
2306
2307
struct __pyx_vtabstruct_4sage_5rings_7integer_Integer {
2308
struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
2309
int (*_to_ZZ)(struct __pyx_obj_4sage_5rings_7integer_Integer *, ZZ *);
2310
void (*set_from_mpz)(struct __pyx_obj_4sage_5rings_7integer_Integer *, __mpz_struct *);
2311
PyObject *(*hash_c)(struct __pyx_obj_4sage_5rings_7integer_Integer *);
2312
PyObject *(*_pari_)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2313
PyObject *(*_shift_helper)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int, int __pyx_skip_dispatch);
2314
PyObject *(*_and)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2315
PyObject *(*_or)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2316
PyObject *(*_xor)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2317
size_t (*_exact_log_log2_iter)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2318
size_t (*_exact_log_mpfi_log)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int __pyx_skip_dispatch);
2319
struct __pyx_obj_4sage_9structure_7element_RingElement *(*_valuation)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2320
PyObject *(*_val_unit)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2321
struct __pyx_obj_4sage_5rings_7integer_Integer *(*_divide_knowing_divisible_by)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2322
int (*_is_power_of)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2323
int (*_pseudoprime_is_prime)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
2324
PyObject *(*_pari_divisors_small)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2325
PyObject *(*_reduce_set)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
2326
};
2327
static struct __pyx_vtabstruct_4sage_5rings_7integer_Integer *__pyx_vtabptr_4sage_5rings_7integer_Integer;
2328
2329
2330
/* "sage/rings/integer.pxd":37
2331
* cdef Integer smallInteger(long value)
2332
*
2333
* cdef class int_to_Z(Morphism): # <<<<<<<<<<<<<<
2334
* pass
2335
*/
2336
2337
struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z {
2338
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
2339
};
2340
static struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z *__pyx_vtabptr_4sage_5rings_7integer_int_to_Z;
2341
2342
2343
/* "parent_old.pxd":15
2344
*
2345
*
2346
* cdef class Parent(parent.Parent): # <<<<<<<<<<<<<<
2347
*
2348
* # returns a Morphism from S to self, or None
2349
*/
2350
2351
struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent {
2352
struct __pyx_vtabstruct_4sage_9structure_6parent_Parent __pyx_base;
2353
PyObject *(*coerce_map_from_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
2354
PyObject *(*coerce_map_from_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
2355
PyObject *(*get_action_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
2356
PyObject *(*get_action_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, PyObject *, int);
2357
PyObject *(*has_coerce_map_from_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
2358
PyObject *(*has_coerce_map_from_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
2359
PyObject *(*_coerce_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
2360
PyObject *(*_coerce_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
2361
PyObject *(*_an_element_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *);
2362
PyObject *(*_an_element_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, int __pyx_skip_dispatch);
2363
};
2364
static struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent *__pyx_vtabptr_4sage_9structure_10parent_old_Parent;
2365
2366
2367
/* "parent_base.pxd":11
2368
* from .parent_old cimport Parent as Parent_old
2369
*
2370
* cdef class ParentWithBase(Parent_old): # <<<<<<<<<<<<<<
2371
* pass
2372
*/
2373
2374
struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase {
2375
struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent __pyx_base;
2376
};
2377
static struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase *__pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase;
2378
2379
2380
/* "sage/structure/parent_gens.pxd":18
2381
*
2382
*
2383
* cdef class ParentWithGens(ParentWithBase): # <<<<<<<<<<<<<<
2384
* cdef public object _gens
2385
* cdef public object _latex_names
2386
*/
2387
2388
struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens {
2389
struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase __pyx_base;
2390
};
2391
static struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens *__pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens;
2392
2393
2394
/* "sage/rings/ring.pxd":5
2395
* cpdef bint _is_Field(x) except -2
2396
*
2397
* cdef class Ring(ParentWithGens): # <<<<<<<<<<<<<<
2398
* cdef public object _zero_element
2399
* cdef public object _one_element
2400
*/
2401
2402
struct __pyx_vtabstruct_4sage_5rings_4ring_Ring {
2403
struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens __pyx_base;
2404
};
2405
static struct __pyx_vtabstruct_4sage_5rings_4ring_Ring *__pyx_vtabptr_4sage_5rings_4ring_Ring;
2406
2407
2408
/* "sage/rings/ring.pxd":13
2409
* cdef _an_element_c_impl(self)
2410
*
2411
* cdef class CommutativeRing(Ring): # <<<<<<<<<<<<<<
2412
* cdef public object __fraction_field
2413
*
2414
*/
2415
2416
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing {
2417
struct __pyx_vtabstruct_4sage_5rings_4ring_Ring __pyx_base;
2418
};
2419
static struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing *__pyx_vtabptr_4sage_5rings_4ring_CommutativeRing;
2420
2421
2422
/* "sage/rings/ring.pxd":16
2423
* cdef public object __fraction_field
2424
*
2425
* cdef class IntegralDomain(CommutativeRing): # <<<<<<<<<<<<<<
2426
* pass
2427
*
2428
*/
2429
2430
struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain {
2431
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
2432
};
2433
static struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain *__pyx_vtabptr_4sage_5rings_4ring_IntegralDomain;
2434
2435
2436
/* "sage/rings/ring.pxd":19
2437
* pass
2438
*
2439
* cdef class DedekindDomain(IntegralDomain): # <<<<<<<<<<<<<<
2440
* pass
2441
*
2442
*/
2443
2444
struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain {
2445
struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain __pyx_base;
2446
};
2447
static struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain *__pyx_vtabptr_4sage_5rings_4ring_DedekindDomain;
2448
2449
2450
/* "sage/rings/ring.pxd":23
2451
*
2452
*
2453
* cdef class PrincipalIdealDomain(IntegralDomain): # <<<<<<<<<<<<<<
2454
* pass
2455
*
2456
*/
2457
2458
struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain {
2459
struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain __pyx_base;
2460
};
2461
static struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain *__pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain;
2462
2463
2464
/* "sage/rings/ring.pxd":26
2465
* pass
2466
*
2467
* cdef class EuclideanDomain(PrincipalIdealDomain): # <<<<<<<<<<<<<<
2468
* pass
2469
*
2470
*/
2471
2472
struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain {
2473
struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
2474
};
2475
static struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain *__pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain;
2476
2477
2478
/* "sage/rings/ring.pxd":29
2479
* pass
2480
*
2481
* cdef class Field(PrincipalIdealDomain): # <<<<<<<<<<<<<<
2482
* pass
2483
*
2484
*/
2485
2486
struct __pyx_vtabstruct_4sage_5rings_4ring_Field {
2487
struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
2488
};
2489
static struct __pyx_vtabstruct_4sage_5rings_4ring_Field *__pyx_vtabptr_4sage_5rings_4ring_Field;
2490
2491
2492
/* "sage/rings/ring.pxd":32
2493
* pass
2494
*
2495
* cdef class Algebra(Ring): # <<<<<<<<<<<<<<
2496
* pass
2497
*
2498
*/
2499
2500
struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra {
2501
struct __pyx_vtabstruct_4sage_5rings_4ring_Ring __pyx_base;
2502
};
2503
static struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra *__pyx_vtabptr_4sage_5rings_4ring_Algebra;
2504
2505
2506
/* "sage/rings/ring.pxd":35
2507
* pass
2508
*
2509
* cdef class CommutativeAlgebra(CommutativeRing): # <<<<<<<<<<<<<<
2510
* pass
2511
*/
2512
2513
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra {
2514
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
2515
};
2516
static struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra *__pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra;
2517
2518
2519
/* "polynomial_compiled.pxd":5
2520
*
2521
*
2522
* cdef class generic_pd # <<<<<<<<<<<<<<
2523
*
2524
* cdef class CompiledPolynomialFunction:
2525
*/
2526
2527
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd {
2528
int (*eval)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *, PyObject *, PyObject *);
2529
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *(*nodummies)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
2530
void (*reset)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
2531
};
2532
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd;
2533
2534
2535
/* "polynomial_compiled.pxd":7
2536
* cdef class generic_pd
2537
*
2538
* cdef class CompiledPolynomialFunction: # <<<<<<<<<<<<<<
2539
* cdef generic_pd _dag
2540
* cdef object _coeffs
2541
*/
2542
2543
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction {
2544
PyObject *(*_parse_structure)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *);
2545
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *(*_get_gap)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree *, int);
2546
void (*_fill_gaps_binary)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree *);
2547
PyObject *(*eval)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, PyObject *);
2548
};
2549
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction;
2550
2551
2552
/* "polynomial_compiled.pxd":24
2553
* cdef void reset(self)
2554
*
2555
* cdef class dummy_pd(generic_pd): # <<<<<<<<<<<<<<
2556
* cdef generic_pd link
2557
* cdef void fill(dummy_pd self, generic_pd link)
2558
*/
2559
2560
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd {
2561
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2562
void (*fill)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd *, struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
2563
};
2564
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd;
2565
2566
2567
/* "polynomial_compiled.pxd":28
2568
* cdef void fill(dummy_pd self, generic_pd link)
2569
*
2570
* cdef class var_pd(generic_pd): # <<<<<<<<<<<<<<
2571
* cdef int index
2572
*
2573
*/
2574
2575
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd {
2576
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2577
};
2578
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd;
2579
2580
2581
/* "polynomial_compiled.pxd":31
2582
* cdef int index
2583
*
2584
* cdef class univar_pd(generic_pd): # <<<<<<<<<<<<<<
2585
* pass
2586
*
2587
*/
2588
2589
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd {
2590
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2591
};
2592
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd;
2593
2594
2595
/* "polynomial_compiled.pxd":34
2596
* pass
2597
*
2598
* cdef class coeff_pd(generic_pd): # <<<<<<<<<<<<<<
2599
* cdef int index
2600
*
2601
*/
2602
2603
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd {
2604
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2605
};
2606
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd;
2607
2608
2609
/* "polynomial_compiled.pxd":38
2610
*
2611
*
2612
* cdef class unary_pd(generic_pd): # <<<<<<<<<<<<<<
2613
* cdef generic_pd operand
2614
*
2615
*/
2616
2617
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd {
2618
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2619
};
2620
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd;
2621
2622
2623
/* "polynomial_compiled.pxd":41
2624
* cdef generic_pd operand
2625
*
2626
* cdef class sqr_pd(unary_pd): # <<<<<<<<<<<<<<
2627
* pass
2628
*
2629
*/
2630
2631
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd {
2632
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
2633
};
2634
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd;
2635
2636
2637
/* "polynomial_compiled.pxd":44
2638
* pass
2639
*
2640
* cdef class pow_pd(unary_pd): # <<<<<<<<<<<<<<
2641
* cdef object exponent
2642
*
2643
*/
2644
2645
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd {
2646
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
2647
};
2648
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd;
2649
2650
2651
/* "polynomial_compiled.pxd":48
2652
*
2653
*
2654
* cdef class binary_pd(generic_pd): # <<<<<<<<<<<<<<
2655
* cdef generic_pd left, right
2656
*
2657
*/
2658
2659
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd {
2660
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2661
};
2662
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd;
2663
2664
2665
/* "polynomial_compiled.pxd":51
2666
* cdef generic_pd left, right
2667
*
2668
* cdef class add_pd(binary_pd): # <<<<<<<<<<<<<<
2669
* pass
2670
*
2671
*/
2672
2673
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd {
2674
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
2675
};
2676
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd;
2677
2678
2679
/* "polynomial_compiled.pxd":54
2680
* pass
2681
*
2682
* cdef class mul_pd(binary_pd): # <<<<<<<<<<<<<<
2683
* pass
2684
*
2685
*/
2686
2687
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd {
2688
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
2689
};
2690
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd;
2691
2692
2693
/* "polynomial_compiled.pxd":57
2694
* pass
2695
*
2696
* cdef class abc_pd(binary_pd): # <<<<<<<<<<<<<<
2697
* cdef int index
2698
*
2699
*/
2700
2701
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd {
2702
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
2703
};
2704
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd;
2705
2706
2707
/* "sage/rings/polynomial/polynomial_element.pxd":8
2708
*
2709
*
2710
* cdef class Polynomial(CommutativeAlgebraElement): # <<<<<<<<<<<<<<
2711
* cdef char _is_gen
2712
* cdef CompiledPolynomialFunction _compiled
2713
*/
2714
2715
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial {
2716
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement __pyx_base;
2717
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*truncate)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
2718
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*inverse_series_trunc)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
2719
long (*_hash_c)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *);
2720
PyObject *(*constant_coefficient)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
2721
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_new_constant_poly)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, PyObject *, struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
2722
int (*is_zero)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
2723
int (*is_one)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
2724
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_mul_trunc_)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
2725
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*_power_trunc)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, unsigned long, long, int __pyx_skip_dispatch);
2726
PyObject *(*_inplace_truncate)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long);
2727
PyObject *(*get_unsafe)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, Py_ssize_t);
2728
};
2729
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial;
2730
2731
2732
/* "sage/rings/polynomial/polynomial_element.pxd":29
2733
* cdef get_unsafe(self, Py_ssize_t i)
2734
*
2735
* cdef class Polynomial_generic_dense(Polynomial): # <<<<<<<<<<<<<<
2736
* cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P)
2737
* cdef list __coeffs
2738
*/
2739
2740
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense {
2741
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial __pyx_base;
2742
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *(*_new_c)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *, PyObject *, struct __pyx_obj_4sage_9structure_6parent_Parent *);
2743
int (*__pyx___normalize)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *);
2744
};
2745
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense;
2746
2747
2748
/* "sage/rings/polynomial/polynomial_element.pxd":34
2749
* cdef int __normalize(self) except -1
2750
*
2751
* cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense): # <<<<<<<<<<<<<<
2752
* pass
2753
*
2754
*/
2755
2756
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact {
2757
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense __pyx_base;
2758
};
2759
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact;
2760
2761
2762
/* "sage/libs/ntl/ntl_ZZX.pxd":3
2763
* from .types cimport ZZX_c
2764
*
2765
* cdef class ntl_ZZX(object): # <<<<<<<<<<<<<<
2766
* cdef ZZX_c x
2767
* cdef void setitem_from_int(ntl_ZZX self, long i, int value)
2768
*/
2769
2770
struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX {
2771
void (*setitem_from_int)(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *, long, int);
2772
int (*getitem_as_int)(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *, long);
2773
};
2774
static struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX;
2775
2776
2777
/* "sage/libs/ntl/ntl_ZZ.pxd":3
2778
* from sage.libs.ntl.types cimport ZZ_c
2779
*
2780
* cdef class ntl_ZZ(object): # <<<<<<<<<<<<<<
2781
* cdef ZZ_c x
2782
* cdef int get_as_int(ntl_ZZ self)
2783
*/
2784
2785
struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ {
2786
int (*get_as_int)(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *);
2787
void (*set_from_int)(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *, int);
2788
};
2789
static struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ;
2790
2791
2792
/* "number_field_element.pxd":11
2793
* from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
2794
*
2795
* cdef class NumberFieldElement(FieldElement): # <<<<<<<<<<<<<<
2796
* cdef ZZX_c __numerator
2797
* cdef ZZ_c __denominator
2798
*/
2799
2800
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement {
2801
struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement __pyx_base;
2802
PyObject *(*_new)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
2803
PyObject *(*number_field)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
2804
void (*_ntl_coeff_as_mpz)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, __mpz_struct *, long);
2805
void (*_ntl_denom_as_mpz)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, __mpz_struct *);
2806
void (*_reduce_c_)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
2807
PyObject *(*_coefficients)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
2808
int (*is_rational)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
2809
int (*is_one)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
2810
int (*_randomize)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, PyObject *, PyObject *, PyObject *);
2811
};
2812
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement;
2813
2814
2815
/* "number_field_element.pxd":38
2816
*
2817
*
2818
* cdef class NumberFieldElement_absolute(NumberFieldElement): # <<<<<<<<<<<<<<
2819
* pass
2820
*
2821
*/
2822
2823
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute {
2824
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
2825
};
2826
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute;
2827
2828
2829
/* "number_field_element.pxd":41
2830
* pass
2831
*
2832
* cdef class NumberFieldElement_relative(NumberFieldElement): # <<<<<<<<<<<<<<
2833
* pass
2834
*
2835
*/
2836
2837
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative {
2838
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
2839
};
2840
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative;
2841
2842
2843
/* "number_field_element.pxd":46
2844
* # TODO: cyclotomic and/or quadratic classes? (Both for differing implementations and speed).
2845
*
2846
* cdef class OrderElement_absolute(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
2847
* cdef object _number_field
2848
*
2849
*/
2850
2851
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute {
2852
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
2853
};
2854
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute;
2855
2856
2857
/* "number_field_element.pxd":49
2858
* cdef object _number_field
2859
*
2860
* cdef class OrderElement_relative(NumberFieldElement_relative): # <<<<<<<<<<<<<<
2861
* cdef object _number_field
2862
*/
2863
2864
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative {
2865
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative __pyx_base;
2866
};
2867
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative;
2868
2869
2870
/* "sage/rings/number_field/number_field_element_quadratic.pxd":6
2871
*
2872
*
2873
* cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
2874
* # (a + b sqrt(D)) / denom
2875
* cdef mpz_t a, b, denom
2876
*/
2877
2878
struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic {
2879
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
2880
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *(*galois_conjugate)(struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *, int __pyx_skip_dispatch);
2881
int (*is_sqrt_disc)(struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *);
2882
};
2883
static struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *__pyx_vtabptr_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic;
2884
2885
2886
/* "sage/rings/number_field/number_field_element_quadratic.pxd":19
2887
*
2888
*
2889
* cdef class OrderElement_quadratic(NumberFieldElement_quadratic): # <<<<<<<<<<<<<<
2890
* pass
2891
*/
2892
2893
struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic {
2894
struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic __pyx_base;
2895
};
2896
static struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic *__pyx_vtabptr_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic;
2897
2898
2899
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":7
2900
* ctypedef long residue_element[2]
2901
*
2902
* cdef class ResidueRingElement # <<<<<<<<<<<<<<
2903
*
2904
* cdef class ResidueRing_abstract(CommutativeRing):
2905
*/
2906
2907
struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement {
2908
long (*index)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2909
PyObject *(*parent)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2910
PyObject *(*new_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *);
2911
int (*is_unit)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2912
int (*is_square)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2913
PyObject *(*sqrt)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2914
};
2915
static struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement;
2916
2917
2918
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":9
2919
* cdef class ResidueRingElement
2920
*
2921
* cdef class ResidueRing_abstract(CommutativeRing): # <<<<<<<<<<<<<<
2922
* cdef object P, F
2923
* cdef public object element_class, _residue_field
2924
*/
2925
2926
struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract {
2927
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
2928
PyObject *(*element_to_residue_field)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2929
void (*add)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long *);
2930
void (*sub)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long *);
2931
void (*mul)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long *);
2932
int (*inv)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2933
int (*is_unit)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2934
void (*neg)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2935
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *(*new_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *);
2936
int (*coefficients)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *);
2937
int (*coerce_from_nf)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *);
2938
int (*element_is_1)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2939
int (*element_is_0)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2940
void (*set_element_to_1)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2941
void (*set_element_to_0)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2942
void (*set_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2943
int (*set_element_from_tuple)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, PyObject *);
2944
int (*cmp_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2945
int (*pow)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long);
2946
int (*is_square)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2947
int (*sqrt)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2948
int (*ith_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long);
2949
long (*cardinality)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, int __pyx_skip_dispatch);
2950
void (*unsafe_ith_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long);
2951
int (*next_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2952
int (*is_last_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2953
long (*index_of_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2954
long (*index_of_element_in_P)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2955
int (*next_element_in_P)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2956
int (*is_last_element_in_P)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2957
PyObject *(*element_to_str)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2958
};
2959
static struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract;
2960
2961
2962
/* "psage/number_fields/sqrt5/prime.pxd":22
2963
* #################################################################################
2964
*
2965
* cdef class Prime: # <<<<<<<<<<<<<<
2966
* cdef public long p, r
2967
* cdef bint first
2968
*/
2969
2970
struct __pyx_vtabstruct_5psage_13number_fields_5sqrt5_5prime_Prime {
2971
long (*norm)(struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime *, int __pyx_skip_dispatch);
2972
int (*is_split)(struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime *, int __pyx_skip_dispatch);
2973
int (*is_inert)(struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime *, int __pyx_skip_dispatch);
2974
int (*is_ramified)(struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime *, int __pyx_skip_dispatch);
2975
};
2976
static struct __pyx_vtabstruct_5psage_13number_fields_5sqrt5_5prime_Prime *__pyx_vtabptr_5psage_13number_fields_5sqrt5_5prime_Prime;
2977
2978
/* --- Runtime support code (head) --- */
2979
/* Refnanny.proto */
2980
#ifndef CYTHON_REFNANNY
2981
#define CYTHON_REFNANNY 0
2982
#endif
2983
#if CYTHON_REFNANNY
2984
typedef struct {
2985
void (*INCREF)(void*, PyObject*, int);
2986
void (*DECREF)(void*, PyObject*, int);
2987
void (*GOTREF)(void*, PyObject*, int);
2988
void (*GIVEREF)(void*, PyObject*, int);
2989
void* (*SetupContext)(const char*, int, const char*);
2990
void (*FinishContext)(void**);
2991
} __Pyx_RefNannyAPIStruct;
2992
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
2993
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
2994
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
2995
#ifdef WITH_THREAD
2996
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
2997
if (acquire_gil) {\
2998
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
2999
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
3000
PyGILState_Release(__pyx_gilstate_save);\
3001
} else {\
3002
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
3003
}
3004
#else
3005
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
3006
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
3007
#endif
3008
#define __Pyx_RefNannyFinishContext()\
3009
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
3010
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3011
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3012
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3013
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3014
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
3015
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
3016
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
3017
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
3018
#else
3019
#define __Pyx_RefNannyDeclarations
3020
#define __Pyx_RefNannySetupContext(name, acquire_gil)
3021
#define __Pyx_RefNannyFinishContext()
3022
#define __Pyx_INCREF(r) Py_INCREF(r)
3023
#define __Pyx_DECREF(r) Py_DECREF(r)
3024
#define __Pyx_GOTREF(r)
3025
#define __Pyx_GIVEREF(r)
3026
#define __Pyx_XINCREF(r) Py_XINCREF(r)
3027
#define __Pyx_XDECREF(r) Py_XDECREF(r)
3028
#define __Pyx_XGOTREF(r)
3029
#define __Pyx_XGIVEREF(r)
3030
#endif
3031
#define __Pyx_XDECREF_SET(r, v) do {\
3032
PyObject *tmp = (PyObject *) r;\
3033
r = v; __Pyx_XDECREF(tmp);\
3034
} while (0)
3035
#define __Pyx_DECREF_SET(r, v) do {\
3036
PyObject *tmp = (PyObject *) r;\
3037
r = v; __Pyx_DECREF(tmp);\
3038
} while (0)
3039
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
3040
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
3041
3042
/* PyObjectGetAttrStr.proto */
3043
#if CYTHON_USE_TYPE_SLOTS
3044
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
3045
PyTypeObject* tp = Py_TYPE(obj);
3046
if (likely(tp->tp_getattro))
3047
return tp->tp_getattro(obj, attr_name);
3048
#if PY_MAJOR_VERSION < 3
3049
if (likely(tp->tp_getattr))
3050
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
3051
#endif
3052
return PyObject_GetAttr(obj, attr_name);
3053
}
3054
#else
3055
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
3056
#endif
3057
3058
/* GetBuiltinName.proto */
3059
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
3060
3061
/* PyCFunctionFastCall.proto */
3062
#if CYTHON_FAST_PYCCALL
3063
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
3064
#else
3065
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
3066
#endif
3067
3068
/* PyFunctionFastCall.proto */
3069
#if CYTHON_FAST_PYCALL
3070
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
3071
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
3072
#if 1 || PY_VERSION_HEX < 0x030600B1
3073
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
3074
#else
3075
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
3076
#endif
3077
#endif
3078
3079
/* PyObjectCall.proto */
3080
#if CYTHON_COMPILING_IN_CPYTHON
3081
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
3082
#else
3083
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
3084
#endif
3085
3086
/* PyObjectCallMethO.proto */
3087
#if CYTHON_COMPILING_IN_CPYTHON
3088
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
3089
#endif
3090
3091
/* PyObjectCallOneArg.proto */
3092
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
3093
3094
/* PyObjectCallNoArg.proto */
3095
#if CYTHON_COMPILING_IN_CPYTHON
3096
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
3097
#else
3098
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
3099
#endif
3100
3101
/* RaiseTooManyValuesToUnpack.proto */
3102
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
3103
3104
/* RaiseNeedMoreValuesToUnpack.proto */
3105
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
3106
3107
/* IterFinish.proto */
3108
static CYTHON_INLINE int __Pyx_IterFinish(void);
3109
3110
/* UnpackItemEndCheck.proto */
3111
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
3112
3113
/* RaiseArgTupleInvalid.proto */
3114
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
3115
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
3116
3117
/* RaiseDoubleKeywords.proto */
3118
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
3119
3120
/* ParseKeywords.proto */
3121
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
3122
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
3123
const char* function_name);
3124
3125
/* PyThreadStateGet.proto */
3126
#if CYTHON_FAST_THREAD_STATE
3127
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
3128
#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
3129
#else
3130
#define __Pyx_PyThreadState_declare
3131
#define __Pyx_PyThreadState_assign
3132
#endif
3133
3134
/* PyErrFetchRestore.proto */
3135
#if CYTHON_FAST_THREAD_STATE
3136
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
3137
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
3138
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
3139
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
3140
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
3141
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
3142
#else
3143
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
3144
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
3145
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
3146
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
3147
#endif
3148
3149
/* RaiseException.proto */
3150
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
3151
3152
/* GetModuleGlobalName.proto */
3153
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
3154
3155
/* GetItemInt.proto */
3156
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3157
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3158
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
3159
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
3160
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
3161
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3162
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3163
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
3164
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
3165
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
3166
int wraparound, int boundscheck);
3167
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3168
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3169
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
3170
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
3171
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
3172
int wraparound, int boundscheck);
3173
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
3174
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
3175
int is_list, int wraparound, int boundscheck);
3176
3177
/* SetItemInt.proto */
3178
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3179
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3180
__Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
3181
(is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
3182
__Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
3183
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
3184
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
3185
int is_list, int wraparound, int boundscheck);
3186
3187
/* PyIntBinop.proto */
3188
#if !CYTHON_COMPILING_IN_PYPY
3189
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
3190
#else
3191
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
3192
PyObject_RichCompare(op1, op2, Py_EQ)
3193
#endif
3194
3195
/* PyIntBinop.proto */
3196
#if !CYTHON_COMPILING_IN_PYPY
3197
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
3198
#else
3199
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
3200
(inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
3201
#endif
3202
3203
/* SaveResetException.proto */
3204
#if CYTHON_FAST_THREAD_STATE
3205
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
3206
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
3207
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
3208
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
3209
#else
3210
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
3211
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
3212
#endif
3213
3214
/* PyErrExceptionMatches.proto */
3215
#if CYTHON_FAST_THREAD_STATE
3216
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
3217
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
3218
#else
3219
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
3220
#endif
3221
3222
/* GetException.proto */
3223
#if CYTHON_FAST_THREAD_STATE
3224
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
3225
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
3226
#else
3227
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
3228
#endif
3229
3230
/* None.proto */
3231
static CYTHON_INLINE long __Pyx_mod_long(long, long);
3232
3233
/* Import.proto */
3234
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
3235
3236
/* ImportFrom.proto */
3237
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
3238
3239
/* ExtTypeTest.proto */
3240
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
3241
3242
/* ListAppend.proto */
3243
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
3244
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
3245
PyListObject* L = (PyListObject*) list;
3246
Py_ssize_t len = Py_SIZE(list);
3247
if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
3248
Py_INCREF(x);
3249
PyList_SET_ITEM(list, len, x);
3250
Py_SIZE(list) = len+1;
3251
return 0;
3252
}
3253
return PyList_Append(list, x);
3254
}
3255
#else
3256
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
3257
#endif
3258
3259
/* FetchCommonType.proto */
3260
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
3261
3262
/* CythonFunction.proto */
3263
#define __Pyx_CyFunction_USED 1
3264
#include <structmember.h>
3265
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
3266
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
3267
#define __Pyx_CYFUNCTION_CCLASS 0x04
3268
#define __Pyx_CyFunction_GetClosure(f)\
3269
(((__pyx_CyFunctionObject *) (f))->func_closure)
3270
#define __Pyx_CyFunction_GetClassObj(f)\
3271
(((__pyx_CyFunctionObject *) (f))->func_classobj)
3272
#define __Pyx_CyFunction_Defaults(type, f)\
3273
((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
3274
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
3275
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
3276
typedef struct {
3277
PyCFunctionObject func;
3278
#if PY_VERSION_HEX < 0x030500A0
3279
PyObject *func_weakreflist;
3280
#endif
3281
PyObject *func_dict;
3282
PyObject *func_name;
3283
PyObject *func_qualname;
3284
PyObject *func_doc;
3285
PyObject *func_globals;
3286
PyObject *func_code;
3287
PyObject *func_closure;
3288
PyObject *func_classobj;
3289
void *defaults;
3290
int defaults_pyobjects;
3291
int flags;
3292
PyObject *defaults_tuple;
3293
PyObject *defaults_kwdict;
3294
PyObject *(*defaults_getter)(PyObject *);
3295
PyObject *func_annotations;
3296
} __pyx_CyFunctionObject;
3297
static PyTypeObject *__pyx_CyFunctionType = 0;
3298
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
3299
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
3300
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
3301
int flags, PyObject* qualname,
3302
PyObject *self,
3303
PyObject *module, PyObject *globals,
3304
PyObject* code);
3305
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
3306
size_t size,
3307
int pyobjects);
3308
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
3309
PyObject *tuple);
3310
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
3311
PyObject *dict);
3312
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
3313
PyObject *dict);
3314
static int __pyx_CyFunction_init(void);
3315
3316
/* IncludeStringH.proto */
3317
#include <string.h>
3318
3319
/* GetVTable.proto */
3320
static void* __Pyx_GetVtable(PyObject *dict);
3321
3322
/* CodeObjectCache.proto */
3323
typedef struct {
3324
PyCodeObject* code_object;
3325
int code_line;
3326
} __Pyx_CodeObjectCacheEntry;
3327
struct __Pyx_CodeObjectCache {
3328
int count;
3329
int max_count;
3330
__Pyx_CodeObjectCacheEntry* entries;
3331
};
3332
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
3333
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
3334
static PyCodeObject *__pyx_find_code_object(int code_line);
3335
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
3336
3337
/* AddTraceback.proto */
3338
static void __Pyx_AddTraceback(const char *funcname, int c_line,
3339
int py_line, const char *filename);
3340
3341
/* CIntToPy.proto */
3342
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
3343
3344
/* None.proto */
3345
#include <new>
3346
3347
/* CIntFromPy.proto */
3348
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
3349
3350
/* CIntFromPy.proto */
3351
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
3352
3353
/* CheckBinaryVersion.proto */
3354
static int __Pyx_check_binary_version(void);
3355
3356
/* PyIdentifierFromString.proto */
3357
#if !defined(__Pyx_PyIdentifier_FromString)
3358
#if PY_MAJOR_VERSION < 3
3359
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
3360
#else
3361
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
3362
#endif
3363
#endif
3364
3365
/* ModuleImport.proto */
3366
static PyObject *__Pyx_ImportModule(const char *name);
3367
3368
/* TypeImport.proto */
3369
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
3370
3371
/* VoidPtrImport.proto */
3372
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
3373
3374
/* InitStrings.proto */
3375
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
3376
3377
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *__pyx_v_self, int __pyx_v_flag); /* proto*/
3378
3379
/* Module declarations from 'libc.string' */
3380
3381
/* Module declarations from 'libc.stdio' */
3382
3383
/* Module declarations from 'sage.libs.gmp.types' */
3384
3385
/* Module declarations from 'libc.stdint' */
3386
3387
/* Module declarations from 'sage.libs.gmp.mpz' */
3388
3389
/* Module declarations from 'sage.libs.ntl.types' */
3390
3391
/* Module declarations from '__builtin__' */
3392
3393
/* Module declarations from 'cpython.type' */
3394
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
3395
3396
/* Module declarations from 'cpython.version' */
3397
3398
/* Module declarations from 'cpython.ref' */
3399
3400
/* Module declarations from 'cpython.exc' */
3401
3402
/* Module declarations from 'cpython.module' */
3403
3404
/* Module declarations from 'cpython.mem' */
3405
3406
/* Module declarations from 'cpython.tuple' */
3407
3408
/* Module declarations from 'cpython.list' */
3409
3410
/* Module declarations from 'cpython.sequence' */
3411
3412
/* Module declarations from 'cpython.mapping' */
3413
3414
/* Module declarations from 'cpython.iterator' */
3415
3416
/* Module declarations from 'cpython.number' */
3417
3418
/* Module declarations from 'cpython.int' */
3419
3420
/* Module declarations from '__builtin__' */
3421
3422
/* Module declarations from 'cpython.bool' */
3423
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
3424
3425
/* Module declarations from 'cpython.long' */
3426
3427
/* Module declarations from 'cpython.float' */
3428
3429
/* Module declarations from '__builtin__' */
3430
3431
/* Module declarations from 'cpython.complex' */
3432
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
3433
3434
/* Module declarations from 'cpython.string' */
3435
3436
/* Module declarations from 'cpython.unicode' */
3437
3438
/* Module declarations from 'cpython.dict' */
3439
3440
/* Module declarations from 'cpython.instance' */
3441
3442
/* Module declarations from 'cpython.function' */
3443
3444
/* Module declarations from 'cpython.method' */
3445
3446
/* Module declarations from 'cpython.weakref' */
3447
3448
/* Module declarations from 'cpython.getargs' */
3449
3450
/* Module declarations from 'cpython.pythread' */
3451
3452
/* Module declarations from 'cpython.pystate' */
3453
3454
/* Module declarations from 'cpython.cobject' */
3455
3456
/* Module declarations from 'cpython.oldbuffer' */
3457
3458
/* Module declarations from 'cpython.set' */
3459
3460
/* Module declarations from 'cpython.buffer' */
3461
3462
/* Module declarations from 'cpython.bytes' */
3463
3464
/* Module declarations from 'cpython.pycapsule' */
3465
3466
/* Module declarations from 'cpython' */
3467
3468
/* Module declarations from 'cpython.object' */
3469
3470
/* Module declarations from 'sage.structure.sage_object' */
3471
static PyTypeObject *__pyx_ptype_4sage_9structure_11sage_object_SageObject = 0;
3472
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(PyObject *, PyObject *, int, int __pyx_skip_dispatch); /*proto*/
3473
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool(int, int, int __pyx_skip_dispatch); /*proto*/
3474
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(int, int, int __pyx_skip_dispatch); /*proto*/
3475
3476
/* Module declarations from 'sage.structure.category_object' */
3477
static PyTypeObject *__pyx_ptype_4sage_9structure_15category_object_CategoryObject = 0;
3478
3479
/* Module declarations from 'sage.misc.cython_metaclass' */
3480
3481
/* Module declarations from 'sage.misc' */
3482
3483
/* Module declarations from 'cython' */
3484
3485
/* Module declarations from 'sage.structure.coerce_dict' */
3486
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = 0;
3487
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = 0;
3488
3489
/* Module declarations from 'sage.misc.inherit_comparison' */
3490
static PyTypeObject *__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = 0;
3491
3492
/* Module declarations from 'sage.structure' */
3493
3494
/* Module declarations from 'sage' */
3495
3496
/* Module declarations from 'sage.structure.parent' */
3497
static PyTypeObject *__pyx_ptype_4sage_9structure_6parent_Parent = 0;
3498
3499
/* Module declarations from 'sage.structure.element' */
3500
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Element = 0;
3501
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = 0;
3502
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ModuleElement = 0;
3503
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_RingElement = 0;
3504
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MonoidElement = 0;
3505
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = 0;
3506
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = 0;
3507
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeRingElement = 0;
3508
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_IntegralDomainElement = 0;
3509
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_DedekindDomainElement = 0;
3510
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = 0;
3511
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = 0;
3512
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_FieldElement = 0;
3513
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AlgebraElement = 0;
3514
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = 0;
3515
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_InfinityElement = 0;
3516
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Vector = 0;
3517
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Matrix = 0;
3518
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CoercionModel = 0;
3519
static struct __pyx_obj_4sage_9structure_7element_CoercionModel **__pyx_vp_4sage_9structure_7element_coercion_model = 0;
3520
#define __pyx_v_4sage_9structure_7element_coercion_model (*__pyx_vp_4sage_9structure_7element_coercion_model)
3521
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *, int __pyx_skip_dispatch); /*proto*/
3522
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *, PyObject *); /*proto*/
3523
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int); /*proto*/
3524
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
3525
3526
/* Module declarations from 'sage.categories.map' */
3527
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Map = 0;
3528
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Section = 0;
3529
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_FormalCompositeMap = 0;
3530
3531
/* Module declarations from 'sage.categories.morphism' */
3532
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_Morphism = 0;
3533
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_SetMorphism = 0;
3534
3535
/* Module declarations from 'sage.rings.integer' */
3536
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_Integer = 0;
3537
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_int_to_Z = 0;
3538
3539
/* Module declarations from 'sage.structure.parent_old' */
3540
static PyTypeObject *__pyx_ptype_4sage_9structure_10parent_old_Parent = 0;
3541
3542
/* Module declarations from 'sage.structure.parent_base' */
3543
static PyTypeObject *__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase = 0;
3544
3545
/* Module declarations from 'sage.structure.parent_gens' */
3546
static PyTypeObject *__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens = 0;
3547
3548
/* Module declarations from 'sage.rings.ring' */
3549
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Ring = 0;
3550
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_CommutativeRing = 0;
3551
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_IntegralDomain = 0;
3552
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_DedekindDomain = 0;
3553
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain = 0;
3554
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_EuclideanDomain = 0;
3555
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Field = 0;
3556
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Algebra = 0;
3557
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra = 0;
3558
3559
/* Module declarations from 'sage.misc.binary_tree' */
3560
static PyTypeObject *__pyx_ptype_4sage_4misc_11binary_tree_BinaryTree = 0;
3561
3562
/* Module declarations from 'sage.rings.polynomial.polynomial_compiled' */
3563
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = 0;
3564
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = 0;
3565
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = 0;
3566
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = 0;
3567
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = 0;
3568
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = 0;
3569
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = 0;
3570
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = 0;
3571
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = 0;
3572
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = 0;
3573
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = 0;
3574
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = 0;
3575
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = 0;
3576
3577
/* Module declarations from 'sage.rings.polynomial.polynomial_element' */
3578
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial = 0;
3579
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = 0;
3580
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = 0;
3581
3582
/* Module declarations from 'sage.libs.ntl.ntl_ZZX' */
3583
static PyTypeObject *__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = 0;
3584
3585
/* Module declarations from 'sage.libs.ntl.ntl_ZZ' */
3586
static PyTypeObject *__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = 0;
3587
3588
/* Module declarations from 'sage.rings.number_field.number_field_element' */
3589
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = 0;
3590
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = 0;
3591
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = 0;
3592
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = 0;
3593
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = 0;
3594
3595
/* Module declarations from 'sage.rings.number_field.number_field_element_quadratic' */
3596
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic = 0;
3597
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic = 0;
3598
3599
/* Module declarations from 'psage.modform.hilbert.sqrt5.sqrt5_fast' */
3600
static PyTypeObject *__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement = 0;
3601
static PyTypeObject *__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract = 0;
3602
3603
/* Module declarations from 'psage.number_fields.sqrt5.prime' */
3604
static PyTypeObject *__pyx_ptype_5psage_13number_fields_5sqrt5_5prime_Prime = 0;
3605
3606
/* Module declarations from 'code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5' */
3607
static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = 0;
3608
static PyObject *__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_split_trace(__mpz_struct *, __mpz_struct *, __mpz_struct *, __mpz_struct *, long, long); /*proto*/
3609
static PyObject *__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_inert_trace(__mpz_struct *, __mpz_struct *, __mpz_struct *, __mpz_struct *, long); /*proto*/
3610
static PyObject *__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_ap(__mpz_struct *, __mpz_struct *, __mpz_struct *, __mpz_struct *, PyObject *); /*proto*/
3611
static PyObject *__Pyx_CFunc_object____object____object____int___to_py(PyObject *(*)(PyObject *, PyObject *, int)); /*proto*/
3612
#define __Pyx_MODULE_NAME "code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5"
3613
int __pyx_module_is_main_code__alex__psage__psage__ellcurve__lseries__aplist_sqrt5 = 0;
3614
3615
/* Implementation of 'code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5' */
3616
static PyObject *__pyx_builtin_ValueError;
3617
static PyObject *__pyx_builtin_range;
3618
static PyObject *__pyx_builtin_TypeError;
3619
static PyObject *__pyx_builtin_AttributeError;
3620
static const char __pyx_k_A[] = "A";
3621
static const char __pyx_k_B[] = "B";
3622
static const char __pyx_k_E[] = "E";
3623
static const char __pyx_k_F[] = "F";
3624
static const char __pyx_k_N[] = "N";
3625
static const char __pyx_k_P[] = "P";
3626
static const char __pyx_k_c[] = "c";
3627
static const char __pyx_k_i[] = "i";
3628
static const char __pyx_k_k[] = "k";
3629
static const char __pyx_k_m[] = "m";
3630
static const char __pyx_k_v[] = "v";
3631
static const char __pyx_k_x[] = "x";
3632
static const char __pyx_k_y[] = "y";
3633
static const char __pyx_k_z[] = "z";
3634
static const char __pyx_k_Ax[] = "Ax";
3635
static const char __pyx_k_Ay[] = "Ay";
3636
static const char __pyx_k_Bx[] = "Bx";
3637
static const char __pyx_k_By[] = "By";
3638
static const char __pyx_k_a1[] = "a1";
3639
static const char __pyx_k_a2[] = "a2";
3640
static const char __pyx_k_a3[] = "a3";
3641
static const char __pyx_k_a4[] = "a4";
3642
static const char __pyx_k_a6[] = "a6";
3643
static const char __pyx_k_b2[] = "b2";
3644
static const char __pyx_k_b4[] = "b4";
3645
static const char __pyx_k_b6[] = "b6";
3646
static const char __pyx_k_c4[] = "c4";
3647
static const char __pyx_k_c6[] = "c6";
3648
static const char __pyx_k_op[] = "op";
3649
static const char __pyx_k_arg0[] = "arg0";
3650
static const char __pyx_k_arg1[] = "arg1";
3651
static const char __pyx_k_arg2[] = "arg2";
3652
static const char __pyx_k_left[] = "left";
3653
static const char __pyx_k_main[] = "__main__";
3654
static const char __pyx_k_test[] = "__test__";
3655
static const char __pyx_k_wrap[] = "wrap";
3656
static const char __pyx_k_bound[] = "bound";
3657
static const char __pyx_k_ideal[] = "ideal";
3658
static const char __pyx_k_range[] = "range";
3659
static const char __pyx_k_right[] = "right";
3660
static const char __pyx_k_aplist[] = "aplist";
3661
static const char __pyx_k_import[] = "__import__";
3662
static const char __pyx_k_parent[] = "parent";
3663
static const char __pyx_k_primes[] = "primes";
3664
static const char __pyx_k_TypeError[] = "TypeError";
3665
static const char __pyx_k_conductor[] = "conductor";
3666
static const char __pyx_k_fast_only[] = "fast_only";
3667
static const char __pyx_k_valuation[] = "valuation";
3668
static const char __pyx_k_ValueError[] = "ValueError";
3669
static const char __pyx_k_base_field[] = "base_field";
3670
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
3671
static const char __pyx_k_sage_ideal[] = "sage_ideal";
3672
static const char __pyx_k_ResidueRing[] = "ResidueRing";
3673
static const char __pyx_k_cardinality[] = "cardinality";
3674
static const char __pyx_k_cfunc_to_py[] = "cfunc.to_py";
3675
static const char __pyx_k_change_ring[] = "change_ring";
3676
static const char __pyx_k_a_invariants[] = "a_invariants";
3677
static const char __pyx_k_aplist_short[] = "aplist_short";
3678
static const char __pyx_k_coefficients[] = "_coefficients";
3679
static const char __pyx_k_stringsource[] = "stringsource";
3680
static const char __pyx_k_residue_field[] = "residue_field";
3681
static const char __pyx_k_AttributeError[] = "AttributeError";
3682
static const char __pyx_k_elliptic_curve_ap[] = "elliptic_curve_ap";
3683
static const char __pyx_k_defining_polynomial[] = "defining_polynomial";
3684
static const char __pyx_k_global_minimal_model[] = "global_minimal_model";
3685
static const char __pyx_k_aplist_remaining_slow[] = "aplist_remaining_slow";
3686
static const char __pyx_k_primes_of_bounded_norm[] = "primes_of_bounded_norm";
3687
static const char __pyx_k_Pyx_CFunc_object____object[] = "__Pyx_CFunc_object____object____object____int___to_py.<locals>.wrap";
3688
static const char __pyx_k_psage_libs_smalljac_wrapper1[] = "psage.libs.smalljac.wrapper1";
3689
static const char __pyx_k_short_weierstrass_invariants[] = "short_weierstrass_invariants";
3690
static const char __pyx_k_psage_number_fields_sqrt5_misc[] = "psage.number_fields.sqrt5.misc";
3691
static const char __pyx_k_coefficients_of_the_input_curve[] = "coefficients of the input curve must be algebraic integers";
3692
static const char __pyx_k_projects_68c8b2b8_03ba_44d4_a0d[] = "/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx";
3693
static const char __pyx_k_psage_number_fields_sqrt5_prime[] = "psage.number_fields.sqrt5.prime";
3694
static const char __pyx_k_E_must_have_base_field_with_defi[] = "E must have base field with defining polynomial x^2-x-1";
3695
static const char __pyx_k_File_aplist_sqrt5_pyx_starting_a[] = "File: aplist_sqrt5.pyx (starting at line 1)\n\nFrobenius Traces over Q(sqrt(5))\n\nThis module implements functionality for computing traces `a_P` of\nFrobenius for an elliptic curve over Q(sqrt(5)) efficiently.\n\nEXAMPLES::\n\n sage: from psage.ellcurve.lseries.aplist_sqrt5 import aplist\n sage: from psage.number_fields.sqrt5.misc import F, a\n sage: E = EllipticCurve([1,-a,a,a+2,a-5])\n sage: aplist(E, 60)\n [-3, -1, 5, -4, 5, 8, 1, 9, -10, 10, 10, -4, 6, -10, 4, 3]\n\nThe `a_P` in the above list exactly correspond to those output by the primes_of_bounded_norm function::\n\n sage: from psage.number_fields.sqrt5 import primes_of_bounded_norm\n sage: primes_of_bounded_norm(60)\n [2, 5a, 3, 11a, 11b, 19a, 19b, 29a, 29b, 31a, 31b, 41a, 41b, 7, 59a, 59b]\n";
3696
static const char __pyx_k_code_alex_psage_psage_ellcurve_l[] = "code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5";
3697
static const char __pyx_k_has_split_multiplicative_reducti[] = "has_split_multiplicative_reduction";
3698
static const char __pyx_k_input_lists_v_and_primes_must_ha[] = "input lists v and primes must have the same length";
3699
static const char __pyx_k_psage_modform_hilbert_sqrt5_sqrt[] = "psage.modform.hilbert.sqrt5.sqrt5_fast";
3700
static PyObject *__pyx_n_s_A;
3701
static PyObject *__pyx_n_s_AttributeError;
3702
static PyObject *__pyx_n_s_Ax;
3703
static PyObject *__pyx_n_s_Ay;
3704
static PyObject *__pyx_n_s_B;
3705
static PyObject *__pyx_n_s_Bx;
3706
static PyObject *__pyx_n_s_By;
3707
static PyObject *__pyx_n_s_E;
3708
static PyObject *__pyx_kp_s_E_must_have_base_field_with_defi;
3709
static PyObject *__pyx_n_s_F;
3710
static PyObject *__pyx_n_s_N;
3711
static PyObject *__pyx_n_s_P;
3712
static PyObject *__pyx_n_s_Pyx_CFunc_object____object;
3713
static PyObject *__pyx_n_s_ResidueRing;
3714
static PyObject *__pyx_n_s_TypeError;
3715
static PyObject *__pyx_n_s_ValueError;
3716
static PyObject *__pyx_n_s_a1;
3717
static PyObject *__pyx_n_s_a2;
3718
static PyObject *__pyx_n_s_a3;
3719
static PyObject *__pyx_n_s_a4;
3720
static PyObject *__pyx_n_s_a6;
3721
static PyObject *__pyx_n_s_a_invariants;
3722
static PyObject *__pyx_n_s_aplist;
3723
static PyObject *__pyx_n_s_aplist_remaining_slow;
3724
static PyObject *__pyx_n_s_aplist_short;
3725
static PyObject *__pyx_n_s_arg0;
3726
static PyObject *__pyx_n_s_arg1;
3727
static PyObject *__pyx_n_s_arg2;
3728
static PyObject *__pyx_n_s_b2;
3729
static PyObject *__pyx_n_s_b4;
3730
static PyObject *__pyx_n_s_b6;
3731
static PyObject *__pyx_n_s_base_field;
3732
static PyObject *__pyx_n_s_bound;
3733
static PyObject *__pyx_n_s_c;
3734
static PyObject *__pyx_n_s_c4;
3735
static PyObject *__pyx_n_s_c6;
3736
static PyObject *__pyx_n_s_cardinality;
3737
static PyObject *__pyx_n_s_cfunc_to_py;
3738
static PyObject *__pyx_n_s_change_ring;
3739
static PyObject *__pyx_n_s_code_alex_psage_psage_ellcurve_l;
3740
static PyObject *__pyx_n_s_coefficients;
3741
static PyObject *__pyx_kp_s_coefficients_of_the_input_curve;
3742
static PyObject *__pyx_n_s_conductor;
3743
static PyObject *__pyx_n_s_defining_polynomial;
3744
static PyObject *__pyx_n_s_elliptic_curve_ap;
3745
static PyObject *__pyx_n_s_fast_only;
3746
static PyObject *__pyx_n_s_global_minimal_model;
3747
static PyObject *__pyx_n_s_has_split_multiplicative_reducti;
3748
static PyObject *__pyx_n_s_i;
3749
static PyObject *__pyx_n_s_ideal;
3750
static PyObject *__pyx_n_s_import;
3751
static PyObject *__pyx_kp_s_input_lists_v_and_primes_must_ha;
3752
static PyObject *__pyx_n_s_k;
3753
static PyObject *__pyx_n_s_left;
3754
static PyObject *__pyx_n_s_m;
3755
static PyObject *__pyx_n_s_main;
3756
static PyObject *__pyx_n_s_op;
3757
static PyObject *__pyx_n_s_parent;
3758
static PyObject *__pyx_n_s_primes;
3759
static PyObject *__pyx_n_s_primes_of_bounded_norm;
3760
static PyObject *__pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d;
3761
static PyObject *__pyx_n_s_psage_libs_smalljac_wrapper1;
3762
static PyObject *__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt;
3763
static PyObject *__pyx_n_s_psage_number_fields_sqrt5_misc;
3764
static PyObject *__pyx_n_s_psage_number_fields_sqrt5_prime;
3765
static PyObject *__pyx_n_s_pyx_vtable;
3766
static PyObject *__pyx_n_s_range;
3767
static PyObject *__pyx_n_s_residue_field;
3768
static PyObject *__pyx_n_s_right;
3769
static PyObject *__pyx_n_s_sage_ideal;
3770
static PyObject *__pyx_n_s_short_weierstrass_invariants;
3771
static PyObject *__pyx_kp_s_stringsource;
3772
static PyObject *__pyx_n_s_test;
3773
static PyObject *__pyx_n_s_v;
3774
static PyObject *__pyx_n_s_valuation;
3775
static PyObject *__pyx_n_s_wrap;
3776
static PyObject *__pyx_n_s_x;
3777
static PyObject *__pyx_n_s_y;
3778
static PyObject *__pyx_n_s_z;
3779
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_short_weierstrass_invariants(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_E); /* proto */
3780
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_2aplist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_E, PyObject *__pyx_v_bound, PyObject *__pyx_v_fast_only); /* proto */
3781
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_4aplist_remaining_slow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_E, PyObject *__pyx_v_v, PyObject *__pyx_v_primes); /* proto */
3782
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_6aplist_short(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_primes); /* proto */
3783
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
3784
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
3785
static PyObject *__pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /* proto */
3786
static PyObject *__pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c); /* proto */
3787
static PyObject *__pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c); /* proto */
3788
static PyObject *__pyx_pf_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_arg0, PyObject *__pyx_v_arg1, int __pyx_v_arg2); /* proto */
3789
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3790
static PyObject *__pyx_int_0;
3791
static PyObject *__pyx_int_1;
3792
static PyObject *__pyx_int_2;
3793
static PyObject *__pyx_int_3;
3794
static PyObject *__pyx_int_4;
3795
static PyObject *__pyx_int_8;
3796
static PyObject *__pyx_int_16;
3797
static PyObject *__pyx_int_24;
3798
static PyObject *__pyx_int_36;
3799
static PyObject *__pyx_int_64;
3800
static PyObject *__pyx_int_216;
3801
static PyObject *__pyx_int_432;
3802
static PyObject *__pyx_int_neg_1;
3803
static PyObject *__pyx_int_neg_27;
3804
static PyObject *__pyx_int_neg_54;
3805
static PyObject *__pyx_tuple_;
3806
static PyObject *__pyx_tuple__2;
3807
static PyObject *__pyx_tuple__3;
3808
static PyObject *__pyx_tuple__5;
3809
static PyObject *__pyx_tuple__7;
3810
static PyObject *__pyx_tuple__9;
3811
static PyObject *__pyx_tuple__11;
3812
static PyObject *__pyx_codeobj__4;
3813
static PyObject *__pyx_codeobj__6;
3814
static PyObject *__pyx_codeobj__8;
3815
static PyObject *__pyx_codeobj__10;
3816
static PyObject *__pyx_codeobj__12;
3817
3818
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":54
3819
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing
3820
*
3821
* def short_weierstrass_invariants(E): # <<<<<<<<<<<<<<
3822
* """
3823
* Compute the invariants of a short Weierstrass form of E.
3824
*/
3825
3826
/* Python wrapper */
3827
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_1short_weierstrass_invariants(PyObject *__pyx_self, PyObject *__pyx_v_E); /*proto*/
3828
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_short_weierstrass_invariants[] = "File: aplist_sqrt5.pyx (starting at line 54)\n\n Compute the invariants of a short Weierstrass form of E.\n\n The main motivation for this function is that it doesn't require\n constructing an elliptic curve like the short_weierstrass_model\n method on E does.\n\n INPUT:\n - E -- an elliptic curve\n\n OUTPUT:\n - two elements A, B of the base field of the curve such that\n E is isomorphic to `y^2 = x^3 + Ax + B`.\n\n EXAMPLES::\n\n sage: from psage.ellcurve.lseries.aplist_sqrt5 import short_weierstrass_invariants\n sage: from psage.number_fields.sqrt5.misc import F, a\n sage: E = EllipticCurve([1,-a,a,a+2,a-5])\n sage: short_weierstrass_invariants(E)\n (1728*a + 2133, 101952*a - 206874)\n sage: E.short_weierstrass_model()\n Elliptic Curve defined by y^2 = x^3 + (1728*a+2133)*x + (101952*a-206874) over Number Field in a with defining polynomial x^2 - x - 1\n ";
3829
static PyMethodDef __pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_1short_weierstrass_invariants = {"short_weierstrass_invariants", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_1short_weierstrass_invariants, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_short_weierstrass_invariants};
3830
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_1short_weierstrass_invariants(PyObject *__pyx_self, PyObject *__pyx_v_E) {
3831
PyObject *__pyx_r = 0;
3832
__Pyx_RefNannyDeclarations
3833
__Pyx_RefNannySetupContext("short_weierstrass_invariants (wrapper)", 0);
3834
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_short_weierstrass_invariants(__pyx_self, ((PyObject *)__pyx_v_E));
3835
3836
/* function exit code */
3837
__Pyx_RefNannyFinishContext();
3838
return __pyx_r;
3839
}
3840
3841
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_short_weierstrass_invariants(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_E) {
3842
PyObject *__pyx_v_a1 = NULL;
3843
PyObject *__pyx_v_a2 = NULL;
3844
PyObject *__pyx_v_a3 = NULL;
3845
PyObject *__pyx_v_a4 = NULL;
3846
PyObject *__pyx_v_a6 = NULL;
3847
PyObject *__pyx_v_b2 = NULL;
3848
PyObject *__pyx_v_b4 = NULL;
3849
PyObject *__pyx_v_b6 = NULL;
3850
PyObject *__pyx_v_c4 = NULL;
3851
PyObject *__pyx_v_c6 = NULL;
3852
PyObject *__pyx_v_A = NULL;
3853
PyObject *__pyx_v_B = NULL;
3854
PyObject *__pyx_r = NULL;
3855
__Pyx_RefNannyDeclarations
3856
PyObject *__pyx_t_1 = NULL;
3857
PyObject *__pyx_t_2 = NULL;
3858
PyObject *__pyx_t_3 = NULL;
3859
PyObject *__pyx_t_4 = NULL;
3860
PyObject *__pyx_t_5 = NULL;
3861
PyObject *__pyx_t_6 = NULL;
3862
PyObject *__pyx_t_7 = NULL;
3863
PyObject *(*__pyx_t_8)(PyObject *);
3864
int __pyx_t_9;
3865
int __pyx_t_10;
3866
__Pyx_RefNannySetupContext("short_weierstrass_invariants", 0);
3867
3868
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":79
3869
* Elliptic Curve defined by y^2 = x^3 + (1728*a+2133)*x + (101952*a-206874) over Number Field in a with defining polynomial x^2 - x - 1
3870
* """
3871
* a1, a2, a3, a4, a6 = E.a_invariants() # <<<<<<<<<<<<<<
3872
* # Compute short Weierstrass form directly (for speed purposes)
3873
* if a1 or a2 or a3:
3874
*/
3875
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_E, __pyx_n_s_a_invariants); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
3876
__Pyx_GOTREF(__pyx_t_2);
3877
__pyx_t_3 = NULL;
3878
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3879
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3880
if (likely(__pyx_t_3)) {
3881
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3882
__Pyx_INCREF(__pyx_t_3);
3883
__Pyx_INCREF(function);
3884
__Pyx_DECREF_SET(__pyx_t_2, function);
3885
}
3886
}
3887
if (__pyx_t_3) {
3888
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
3889
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3890
} else {
3891
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
3892
}
3893
__Pyx_GOTREF(__pyx_t_1);
3894
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3895
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3896
PyObject* sequence = __pyx_t_1;
3897
#if !CYTHON_COMPILING_IN_PYPY
3898
Py_ssize_t size = Py_SIZE(sequence);
3899
#else
3900
Py_ssize_t size = PySequence_Size(sequence);
3901
#endif
3902
if (unlikely(size != 5)) {
3903
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
3904
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3905
__PYX_ERR(0, 79, __pyx_L1_error)
3906
}
3907
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3908
if (likely(PyTuple_CheckExact(sequence))) {
3909
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
3910
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
3911
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
3912
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
3913
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
3914
} else {
3915
__pyx_t_2 = PyList_GET_ITEM(sequence, 0);
3916
__pyx_t_3 = PyList_GET_ITEM(sequence, 1);
3917
__pyx_t_4 = PyList_GET_ITEM(sequence, 2);
3918
__pyx_t_5 = PyList_GET_ITEM(sequence, 3);
3919
__pyx_t_6 = PyList_GET_ITEM(sequence, 4);
3920
}
3921
__Pyx_INCREF(__pyx_t_2);
3922
__Pyx_INCREF(__pyx_t_3);
3923
__Pyx_INCREF(__pyx_t_4);
3924
__Pyx_INCREF(__pyx_t_5);
3925
__Pyx_INCREF(__pyx_t_6);
3926
#else
3927
{
3928
Py_ssize_t i;
3929
PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
3930
for (i=0; i < 5; i++) {
3931
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 79, __pyx_L1_error)
3932
__Pyx_GOTREF(item);
3933
*(temps[i]) = item;
3934
}
3935
}
3936
#endif
3937
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3938
} else {
3939
Py_ssize_t index = -1;
3940
PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
3941
__pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
3942
__Pyx_GOTREF(__pyx_t_7);
3943
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3944
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
3945
for (index=0; index < 5; index++) {
3946
PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
3947
__Pyx_GOTREF(item);
3948
*(temps[index]) = item;
3949
}
3950
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 5) < 0) __PYX_ERR(0, 79, __pyx_L1_error)
3951
__pyx_t_8 = NULL;
3952
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3953
goto __pyx_L4_unpacking_done;
3954
__pyx_L3_unpacking_failed:;
3955
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3956
__pyx_t_8 = NULL;
3957
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3958
__PYX_ERR(0, 79, __pyx_L1_error)
3959
__pyx_L4_unpacking_done:;
3960
}
3961
__pyx_v_a1 = __pyx_t_2;
3962
__pyx_t_2 = 0;
3963
__pyx_v_a2 = __pyx_t_3;
3964
__pyx_t_3 = 0;
3965
__pyx_v_a3 = __pyx_t_4;
3966
__pyx_t_4 = 0;
3967
__pyx_v_a4 = __pyx_t_5;
3968
__pyx_t_5 = 0;
3969
__pyx_v_a6 = __pyx_t_6;
3970
__pyx_t_6 = 0;
3971
3972
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":81
3973
* a1, a2, a3, a4, a6 = E.a_invariants()
3974
* # Compute short Weierstrass form directly (for speed purposes)
3975
* if a1 or a2 or a3: # <<<<<<<<<<<<<<
3976
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
3977
* if b2:
3978
*/
3979
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_a1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
3980
if (!__pyx_t_10) {
3981
} else {
3982
__pyx_t_9 = __pyx_t_10;
3983
goto __pyx_L6_bool_binop_done;
3984
}
3985
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_a2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
3986
if (!__pyx_t_10) {
3987
} else {
3988
__pyx_t_9 = __pyx_t_10;
3989
goto __pyx_L6_bool_binop_done;
3990
}
3991
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_a3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
3992
__pyx_t_9 = __pyx_t_10;
3993
__pyx_L6_bool_binop_done:;
3994
if (__pyx_t_9) {
3995
3996
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":82
3997
* # Compute short Weierstrass form directly (for speed purposes)
3998
* if a1 or a2 or a3:
3999
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6 # <<<<<<<<<<<<<<
4000
* if b2:
4001
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
4002
*/
4003
__pyx_t_1 = PyNumber_Multiply(__pyx_v_a1, __pyx_v_a1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
4004
__Pyx_GOTREF(__pyx_t_1);
4005
__pyx_t_6 = PyNumber_Multiply(__pyx_int_4, __pyx_v_a2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
4006
__Pyx_GOTREF(__pyx_t_6);
4007
__pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error)
4008
__Pyx_GOTREF(__pyx_t_5);
4009
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4010
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4011
__pyx_v_b2 = __pyx_t_5;
4012
__pyx_t_5 = 0;
4013
__pyx_t_5 = PyNumber_Multiply(__pyx_v_a1, __pyx_v_a3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error)
4014
__Pyx_GOTREF(__pyx_t_5);
4015
__pyx_t_6 = PyNumber_Multiply(__pyx_int_2, __pyx_v_a4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
4016
__Pyx_GOTREF(__pyx_t_6);
4017
__pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
4018
__Pyx_GOTREF(__pyx_t_1);
4019
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4020
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4021
__pyx_v_b4 = __pyx_t_1;
4022
__pyx_t_1 = 0;
4023
__pyx_t_1 = PyNumber_Power(__pyx_v_a3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
4024
__Pyx_GOTREF(__pyx_t_1);
4025
__pyx_t_6 = PyNumber_Multiply(__pyx_int_4, __pyx_v_a6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
4026
__Pyx_GOTREF(__pyx_t_6);
4027
__pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error)
4028
__Pyx_GOTREF(__pyx_t_5);
4029
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4030
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4031
__pyx_v_b6 = __pyx_t_5;
4032
__pyx_t_5 = 0;
4033
4034
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":83
4035
* if a1 or a2 or a3:
4036
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
4037
* if b2: # <<<<<<<<<<<<<<
4038
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
4039
* A = -27*c4; B = -54*c6
4040
*/
4041
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_b2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
4042
if (__pyx_t_9) {
4043
4044
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":84
4045
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
4046
* if b2:
4047
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6 # <<<<<<<<<<<<<<
4048
* A = -27*c4; B = -54*c6
4049
* else:
4050
*/
4051
__pyx_t_5 = PyNumber_Power(__pyx_v_b2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error)
4052
__Pyx_GOTREF(__pyx_t_5);
4053
__pyx_t_6 = PyNumber_Multiply(__pyx_int_24, __pyx_v_b4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error)
4054
__Pyx_GOTREF(__pyx_t_6);
4055
__pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
4056
__Pyx_GOTREF(__pyx_t_1);
4057
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4058
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4059
__pyx_v_c4 = __pyx_t_1;
4060
__pyx_t_1 = 0;
4061
__pyx_t_1 = PyNumber_Power(__pyx_v_b2, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
4062
__Pyx_GOTREF(__pyx_t_1);
4063
__pyx_t_6 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error)
4064
__Pyx_GOTREF(__pyx_t_6);
4065
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4066
__pyx_t_1 = PyNumber_Multiply(__pyx_int_36, __pyx_v_b2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
4067
__Pyx_GOTREF(__pyx_t_1);
4068
__pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_b4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error)
4069
__Pyx_GOTREF(__pyx_t_5);
4070
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4071
__pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
4072
__Pyx_GOTREF(__pyx_t_1);
4073
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4074
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4075
__pyx_t_5 = PyNumber_Multiply(__pyx_int_216, __pyx_v_b6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error)
4076
__Pyx_GOTREF(__pyx_t_5);
4077
__pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error)
4078
__Pyx_GOTREF(__pyx_t_6);
4079
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4080
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4081
__pyx_v_c6 = __pyx_t_6;
4082
__pyx_t_6 = 0;
4083
4084
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":85
4085
* if b2:
4086
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
4087
* A = -27*c4; B = -54*c6 # <<<<<<<<<<<<<<
4088
* else:
4089
* A = 8*b4; B = 16*b6
4090
*/
4091
__pyx_t_6 = PyNumber_Multiply(__pyx_int_neg_27, __pyx_v_c4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error)
4092
__Pyx_GOTREF(__pyx_t_6);
4093
__pyx_v_A = __pyx_t_6;
4094
__pyx_t_6 = 0;
4095
__pyx_t_6 = PyNumber_Multiply(__pyx_int_neg_54, __pyx_v_c6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error)
4096
__Pyx_GOTREF(__pyx_t_6);
4097
__pyx_v_B = __pyx_t_6;
4098
__pyx_t_6 = 0;
4099
4100
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":83
4101
* if a1 or a2 or a3:
4102
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
4103
* if b2: # <<<<<<<<<<<<<<
4104
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
4105
* A = -27*c4; B = -54*c6
4106
*/
4107
goto __pyx_L9;
4108
}
4109
4110
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":87
4111
* A = -27*c4; B = -54*c6
4112
* else:
4113
* A = 8*b4; B = 16*b6 # <<<<<<<<<<<<<<
4114
* else:
4115
* A = a4; B = a6
4116
*/
4117
/*else*/ {
4118
__pyx_t_6 = PyNumber_Multiply(__pyx_int_8, __pyx_v_b4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error)
4119
__Pyx_GOTREF(__pyx_t_6);
4120
__pyx_v_A = __pyx_t_6;
4121
__pyx_t_6 = 0;
4122
__pyx_t_6 = PyNumber_Multiply(__pyx_int_16, __pyx_v_b6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error)
4123
__Pyx_GOTREF(__pyx_t_6);
4124
__pyx_v_B = __pyx_t_6;
4125
__pyx_t_6 = 0;
4126
}
4127
__pyx_L9:;
4128
4129
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":81
4130
* a1, a2, a3, a4, a6 = E.a_invariants()
4131
* # Compute short Weierstrass form directly (for speed purposes)
4132
* if a1 or a2 or a3: # <<<<<<<<<<<<<<
4133
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
4134
* if b2:
4135
*/
4136
goto __pyx_L5;
4137
}
4138
4139
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":89
4140
* A = 8*b4; B = 16*b6
4141
* else:
4142
* A = a4; B = a6 # <<<<<<<<<<<<<<
4143
*
4144
* return A, B
4145
*/
4146
/*else*/ {
4147
__Pyx_INCREF(__pyx_v_a4);
4148
__pyx_v_A = __pyx_v_a4;
4149
__Pyx_INCREF(__pyx_v_a6);
4150
__pyx_v_B = __pyx_v_a6;
4151
}
4152
__pyx_L5:;
4153
4154
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":91
4155
* A = a4; B = a6
4156
*
4157
* return A, B # <<<<<<<<<<<<<<
4158
*
4159
* def aplist(E, bound, fast_only=False):
4160
*/
4161
__Pyx_XDECREF(__pyx_r);
4162
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
4163
__Pyx_GOTREF(__pyx_t_6);
4164
__Pyx_INCREF(__pyx_v_A);
4165
__Pyx_GIVEREF(__pyx_v_A);
4166
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_A);
4167
__Pyx_INCREF(__pyx_v_B);
4168
__Pyx_GIVEREF(__pyx_v_B);
4169
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_B);
4170
__pyx_r = __pyx_t_6;
4171
__pyx_t_6 = 0;
4172
goto __pyx_L0;
4173
4174
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":54
4175
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing
4176
*
4177
* def short_weierstrass_invariants(E): # <<<<<<<<<<<<<<
4178
* """
4179
* Compute the invariants of a short Weierstrass form of E.
4180
*/
4181
4182
/* function exit code */
4183
__pyx_L1_error:;
4184
__Pyx_XDECREF(__pyx_t_1);
4185
__Pyx_XDECREF(__pyx_t_2);
4186
__Pyx_XDECREF(__pyx_t_3);
4187
__Pyx_XDECREF(__pyx_t_4);
4188
__Pyx_XDECREF(__pyx_t_5);
4189
__Pyx_XDECREF(__pyx_t_6);
4190
__Pyx_XDECREF(__pyx_t_7);
4191
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.short_weierstrass_invariants", __pyx_clineno, __pyx_lineno, __pyx_filename);
4192
__pyx_r = NULL;
4193
__pyx_L0:;
4194
__Pyx_XDECREF(__pyx_v_a1);
4195
__Pyx_XDECREF(__pyx_v_a2);
4196
__Pyx_XDECREF(__pyx_v_a3);
4197
__Pyx_XDECREF(__pyx_v_a4);
4198
__Pyx_XDECREF(__pyx_v_a6);
4199
__Pyx_XDECREF(__pyx_v_b2);
4200
__Pyx_XDECREF(__pyx_v_b4);
4201
__Pyx_XDECREF(__pyx_v_b6);
4202
__Pyx_XDECREF(__pyx_v_c4);
4203
__Pyx_XDECREF(__pyx_v_c6);
4204
__Pyx_XDECREF(__pyx_v_A);
4205
__Pyx_XDECREF(__pyx_v_B);
4206
__Pyx_XGIVEREF(__pyx_r);
4207
__Pyx_RefNannyFinishContext();
4208
return __pyx_r;
4209
}
4210
4211
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":93
4212
* return A, B
4213
*
4214
* def aplist(E, bound, fast_only=False): # <<<<<<<<<<<<<<
4215
* """
4216
* Compute the traces of Frobenius `a_P` of the elliptic curve E over Q(sqrt(5)) for
4217
*/
4218
4219
/* Python wrapper */
4220
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_3aplist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4221
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_2aplist[] = "File: aplist_sqrt5.pyx (starting at line 93)\n\n Compute the traces of Frobenius `a_P` of the elliptic curve E over Q(sqrt(5)) for\n all primes `P` with norm less than the given bound.\n\n INPUT:\n - `E` -- an elliptic curve given by an integral (but not\n necessarily minimal) model over the number field with\n defining polynomial `x^2-x-1`.\n - ``bound`` -- a nonnegative integer\n - ``fast_only`` -- (bool, default: False) -- if True, only the\n `a_P` that can be computed efficiently are computed, and the\n rest are left as None\n\n EXAMPLES::\n\n sage: from psage.ellcurve.lseries.aplist_sqrt5 import aplist\n sage: K.<a> = NumberField(x^2-x-1); E = EllipticCurve([1,-a,a,a-1,a+3])\n sage: aplist(E,60)\n [1, -2, 2, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]\n sage: from psage.number_fields.sqrt5 import primes_of_bounded_norm\n sage: primes_of_bounded_norm(60)\n [2, 5a, 3, 11a, 11b, 19a, 19b, 29a, 29b, 31a, 31b, 41a, 41b, 7, 59a, 59b]\n\n If you give the fast_only option, then only the `a_P` for which\n the current implemenation can compute quickly are computed::\n \n sage: aplist(E,60,fast_only=True)\n [None, None, None, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]\n\n This is fast enough that up to a million should only take a few\n seconds::\n \n sage: t = cputime(); v = aplist(E,10^6,fast_only=True)\n sage: assert cputime(t) < 15, \"too slow!\"\n\n TESTS::\n\n We test some edge cases::\n\n sage: aplist(E, 0)\n []\n sage: L.<b> = NumberField(x^2-5); F = EllipticCurve([1,-b,b,0,0])\n sage: aplist(F, 50)\n Traceback (most recent call last):\n ...\n ValueError: E must have base field with defining polynomial x^2-x-1\n sage: E = EllipticCurve([1,-a,a,a+2,a/7])\n sage: aplist(E, 50)\n Traceback (most recent call last):\n "" ...\n ValueError: coefficients of the input curve must be algebraic integers\n\n sage: K.<a> = NumberField(x^2 - x - 1)\n sage: E = EllipticCurve(K, [1, 1, 1, 0, 0])\n sage: aplist(E, 50)\n [-3, 1, 1, -4, -4, 4, 4, -2, -2, 0, 0, 10, 10, -14]\n ";
4222
static PyMethodDef __pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_3aplist = {"aplist", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_3aplist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_2aplist};
4223
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_3aplist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4224
PyObject *__pyx_v_E = 0;
4225
PyObject *__pyx_v_bound = 0;
4226
PyObject *__pyx_v_fast_only = 0;
4227
PyObject *__pyx_r = 0;
4228
__Pyx_RefNannyDeclarations
4229
__Pyx_RefNannySetupContext("aplist (wrapper)", 0);
4230
{
4231
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_bound,&__pyx_n_s_fast_only,0};
4232
PyObject* values[3] = {0,0,0};
4233
values[2] = ((PyObject *)Py_False);
4234
if (unlikely(__pyx_kwds)) {
4235
Py_ssize_t kw_args;
4236
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4237
switch (pos_args) {
4238
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4239
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4240
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4241
case 0: break;
4242
default: goto __pyx_L5_argtuple_error;
4243
}
4244
kw_args = PyDict_Size(__pyx_kwds);
4245
switch (pos_args) {
4246
case 0:
4247
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
4248
else goto __pyx_L5_argtuple_error;
4249
case 1:
4250
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bound)) != 0)) kw_args--;
4251
else {
4252
__Pyx_RaiseArgtupleInvalid("aplist", 0, 2, 3, 1); __PYX_ERR(0, 93, __pyx_L3_error)
4253
}
4254
case 2:
4255
if (kw_args > 0) {
4256
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fast_only);
4257
if (value) { values[2] = value; kw_args--; }
4258
}
4259
}
4260
if (unlikely(kw_args > 0)) {
4261
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aplist") < 0)) __PYX_ERR(0, 93, __pyx_L3_error)
4262
}
4263
} else {
4264
switch (PyTuple_GET_SIZE(__pyx_args)) {
4265
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4266
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4267
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4268
break;
4269
default: goto __pyx_L5_argtuple_error;
4270
}
4271
}
4272
__pyx_v_E = values[0];
4273
__pyx_v_bound = values[1];
4274
__pyx_v_fast_only = values[2];
4275
}
4276
goto __pyx_L4_argument_unpacking_done;
4277
__pyx_L5_argtuple_error:;
4278
__Pyx_RaiseArgtupleInvalid("aplist", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 93, __pyx_L3_error)
4279
__pyx_L3_error:;
4280
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
4281
__Pyx_RefNannyFinishContext();
4282
return NULL;
4283
__pyx_L4_argument_unpacking_done:;
4284
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_2aplist(__pyx_self, __pyx_v_E, __pyx_v_bound, __pyx_v_fast_only);
4285
4286
/* function exit code */
4287
__Pyx_RefNannyFinishContext();
4288
return __pyx_r;
4289
}
4290
4291
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_2aplist(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_E, PyObject *__pyx_v_bound, PyObject *__pyx_v_fast_only) {
4292
PyObject *__pyx_v_A = NULL;
4293
PyObject *__pyx_v_B = NULL;
4294
PyObject *__pyx_v_primes = NULL;
4295
PyObject *__pyx_v_v = 0;
4296
PyObject *__pyx_r = NULL;
4297
__Pyx_RefNannyDeclarations
4298
PyObject *__pyx_t_1 = NULL;
4299
PyObject *__pyx_t_2 = NULL;
4300
PyObject *__pyx_t_3 = NULL;
4301
PyObject *__pyx_t_4 = NULL;
4302
int __pyx_t_5;
4303
PyObject *(*__pyx_t_6)(PyObject *);
4304
int __pyx_t_7;
4305
int __pyx_t_8;
4306
__Pyx_RefNannySetupContext("aplist", 0);
4307
4308
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":151
4309
* [-3, 1, 1, -4, -4, 4, 4, -2, -2, 0, 0, 10, 10, -14]
4310
* """
4311
* if list(E.base_field().defining_polynomial()) != [-1,-1,1]: # <<<<<<<<<<<<<<
4312
* raise ValueError, "E must have base field with defining polynomial x^2-x-1"
4313
* A, B = short_weierstrass_invariants(E)
4314
*/
4315
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_E, __pyx_n_s_base_field); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
4316
__Pyx_GOTREF(__pyx_t_3);
4317
__pyx_t_4 = NULL;
4318
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4319
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
4320
if (likely(__pyx_t_4)) {
4321
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4322
__Pyx_INCREF(__pyx_t_4);
4323
__Pyx_INCREF(function);
4324
__Pyx_DECREF_SET(__pyx_t_3, function);
4325
}
4326
}
4327
if (__pyx_t_4) {
4328
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
4329
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4330
} else {
4331
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
4332
}
4333
__Pyx_GOTREF(__pyx_t_2);
4334
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4335
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_defining_polynomial); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
4336
__Pyx_GOTREF(__pyx_t_3);
4337
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4338
__pyx_t_2 = NULL;
4339
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4340
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
4341
if (likely(__pyx_t_2)) {
4342
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4343
__Pyx_INCREF(__pyx_t_2);
4344
__Pyx_INCREF(function);
4345
__Pyx_DECREF_SET(__pyx_t_3, function);
4346
}
4347
}
4348
if (__pyx_t_2) {
4349
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
4350
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4351
} else {
4352
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
4353
}
4354
__Pyx_GOTREF(__pyx_t_1);
4355
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4356
__pyx_t_3 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
4357
__Pyx_GOTREF(__pyx_t_3);
4358
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4359
__pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
4360
__Pyx_GOTREF(__pyx_t_1);
4361
__Pyx_INCREF(__pyx_int_neg_1);
4362
__Pyx_GIVEREF(__pyx_int_neg_1);
4363
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_neg_1);
4364
__Pyx_INCREF(__pyx_int_neg_1);
4365
__Pyx_GIVEREF(__pyx_int_neg_1);
4366
PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_neg_1);
4367
__Pyx_INCREF(__pyx_int_1);
4368
__Pyx_GIVEREF(__pyx_int_1);
4369
PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_1);
4370
__pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
4371
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4372
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4373
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 151, __pyx_L1_error)
4374
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4375
if (__pyx_t_5) {
4376
4377
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":152
4378
* """
4379
* if list(E.base_field().defining_polynomial()) != [-1,-1,1]:
4380
* raise ValueError, "E must have base field with defining polynomial x^2-x-1" # <<<<<<<<<<<<<<
4381
* A, B = short_weierstrass_invariants(E)
4382
* primes = primes_of_bounded_norm(bound)
4383
*/
4384
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_E_must_have_base_field_with_defi, 0, 0);
4385
__PYX_ERR(0, 152, __pyx_L1_error)
4386
4387
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":151
4388
* [-3, 1, 1, -4, -4, 4, 4, -2, -2, 0, 0, 10, 10, -14]
4389
* """
4390
* if list(E.base_field().defining_polynomial()) != [-1,-1,1]: # <<<<<<<<<<<<<<
4391
* raise ValueError, "E must have base field with defining polynomial x^2-x-1"
4392
* A, B = short_weierstrass_invariants(E)
4393
*/
4394
}
4395
4396
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":153
4397
* if list(E.base_field().defining_polynomial()) != [-1,-1,1]:
4398
* raise ValueError, "E must have base field with defining polynomial x^2-x-1"
4399
* A, B = short_weierstrass_invariants(E) # <<<<<<<<<<<<<<
4400
* primes = primes_of_bounded_norm(bound)
4401
* cdef list v = aplist_short(A, B, primes)
4402
*/
4403
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_short_weierstrass_invariants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
4404
__Pyx_GOTREF(__pyx_t_1);
4405
__pyx_t_3 = NULL;
4406
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
4407
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
4408
if (likely(__pyx_t_3)) {
4409
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4410
__Pyx_INCREF(__pyx_t_3);
4411
__Pyx_INCREF(function);
4412
__Pyx_DECREF_SET(__pyx_t_1, function);
4413
}
4414
}
4415
if (!__pyx_t_3) {
4416
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_E); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
4417
__Pyx_GOTREF(__pyx_t_2);
4418
} else {
4419
#if CYTHON_FAST_PYCALL
4420
if (PyFunction_Check(__pyx_t_1)) {
4421
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_E};
4422
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
4423
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4424
__Pyx_GOTREF(__pyx_t_2);
4425
} else
4426
#endif
4427
#if CYTHON_FAST_PYCCALL
4428
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
4429
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_E};
4430
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
4431
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4432
__Pyx_GOTREF(__pyx_t_2);
4433
} else
4434
#endif
4435
{
4436
__pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
4437
__Pyx_GOTREF(__pyx_t_4);
4438
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
4439
__Pyx_INCREF(__pyx_v_E);
4440
__Pyx_GIVEREF(__pyx_v_E);
4441
PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_E);
4442
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
4443
__Pyx_GOTREF(__pyx_t_2);
4444
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4445
}
4446
}
4447
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4448
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
4449
PyObject* sequence = __pyx_t_2;
4450
#if !CYTHON_COMPILING_IN_PYPY
4451
Py_ssize_t size = Py_SIZE(sequence);
4452
#else
4453
Py_ssize_t size = PySequence_Size(sequence);
4454
#endif
4455
if (unlikely(size != 2)) {
4456
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
4457
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4458
__PYX_ERR(0, 153, __pyx_L1_error)
4459
}
4460
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4461
if (likely(PyTuple_CheckExact(sequence))) {
4462
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
4463
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
4464
} else {
4465
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
4466
__pyx_t_4 = PyList_GET_ITEM(sequence, 1);
4467
}
4468
__Pyx_INCREF(__pyx_t_1);
4469
__Pyx_INCREF(__pyx_t_4);
4470
#else
4471
__pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
4472
__Pyx_GOTREF(__pyx_t_1);
4473
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
4474
__Pyx_GOTREF(__pyx_t_4);
4475
#endif
4476
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4477
} else {
4478
Py_ssize_t index = -1;
4479
__pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error)
4480
__Pyx_GOTREF(__pyx_t_3);
4481
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4482
__pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
4483
index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
4484
__Pyx_GOTREF(__pyx_t_1);
4485
index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
4486
__Pyx_GOTREF(__pyx_t_4);
4487
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 2) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
4488
__pyx_t_6 = NULL;
4489
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4490
goto __pyx_L5_unpacking_done;
4491
__pyx_L4_unpacking_failed:;
4492
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4493
__pyx_t_6 = NULL;
4494
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4495
__PYX_ERR(0, 153, __pyx_L1_error)
4496
__pyx_L5_unpacking_done:;
4497
}
4498
__pyx_v_A = __pyx_t_1;
4499
__pyx_t_1 = 0;
4500
__pyx_v_B = __pyx_t_4;
4501
__pyx_t_4 = 0;
4502
4503
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":154
4504
* raise ValueError, "E must have base field with defining polynomial x^2-x-1"
4505
* A, B = short_weierstrass_invariants(E)
4506
* primes = primes_of_bounded_norm(bound) # <<<<<<<<<<<<<<
4507
* cdef list v = aplist_short(A, B, primes)
4508
* if not fast_only:
4509
*/
4510
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_primes_of_bounded_norm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error)
4511
__Pyx_GOTREF(__pyx_t_4);
4512
__pyx_t_1 = NULL;
4513
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4514
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
4515
if (likely(__pyx_t_1)) {
4516
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4517
__Pyx_INCREF(__pyx_t_1);
4518
__Pyx_INCREF(function);
4519
__Pyx_DECREF_SET(__pyx_t_4, function);
4520
}
4521
}
4522
if (!__pyx_t_1) {
4523
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_bound); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
4524
__Pyx_GOTREF(__pyx_t_2);
4525
} else {
4526
#if CYTHON_FAST_PYCALL
4527
if (PyFunction_Check(__pyx_t_4)) {
4528
PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_bound};
4529
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
4530
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4531
__Pyx_GOTREF(__pyx_t_2);
4532
} else
4533
#endif
4534
#if CYTHON_FAST_PYCCALL
4535
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
4536
PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_bound};
4537
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
4538
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4539
__Pyx_GOTREF(__pyx_t_2);
4540
} else
4541
#endif
4542
{
4543
__pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
4544
__Pyx_GOTREF(__pyx_t_3);
4545
__Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
4546
__Pyx_INCREF(__pyx_v_bound);
4547
__Pyx_GIVEREF(__pyx_v_bound);
4548
PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_bound);
4549
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
4550
__Pyx_GOTREF(__pyx_t_2);
4551
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4552
}
4553
}
4554
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4555
__pyx_v_primes = __pyx_t_2;
4556
__pyx_t_2 = 0;
4557
4558
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":155
4559
* A, B = short_weierstrass_invariants(E)
4560
* primes = primes_of_bounded_norm(bound)
4561
* cdef list v = aplist_short(A, B, primes) # <<<<<<<<<<<<<<
4562
* if not fast_only:
4563
* aplist_remaining_slow(E, v, primes)
4564
*/
4565
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_aplist_short); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error)
4566
__Pyx_GOTREF(__pyx_t_4);
4567
__pyx_t_3 = NULL;
4568
__pyx_t_7 = 0;
4569
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4570
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
4571
if (likely(__pyx_t_3)) {
4572
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4573
__Pyx_INCREF(__pyx_t_3);
4574
__Pyx_INCREF(function);
4575
__Pyx_DECREF_SET(__pyx_t_4, function);
4576
__pyx_t_7 = 1;
4577
}
4578
}
4579
#if CYTHON_FAST_PYCALL
4580
if (PyFunction_Check(__pyx_t_4)) {
4581
PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_primes};
4582
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
4583
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4584
__Pyx_GOTREF(__pyx_t_2);
4585
} else
4586
#endif
4587
#if CYTHON_FAST_PYCCALL
4588
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
4589
PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_primes};
4590
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
4591
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4592
__Pyx_GOTREF(__pyx_t_2);
4593
} else
4594
#endif
4595
{
4596
__pyx_t_1 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
4597
__Pyx_GOTREF(__pyx_t_1);
4598
if (__pyx_t_3) {
4599
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
4600
}
4601
__Pyx_INCREF(__pyx_v_A);
4602
__Pyx_GIVEREF(__pyx_v_A);
4603
PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_7, __pyx_v_A);
4604
__Pyx_INCREF(__pyx_v_B);
4605
__Pyx_GIVEREF(__pyx_v_B);
4606
PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_7, __pyx_v_B);
4607
__Pyx_INCREF(__pyx_v_primes);
4608
__Pyx_GIVEREF(__pyx_v_primes);
4609
PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_7, __pyx_v_primes);
4610
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
4611
__Pyx_GOTREF(__pyx_t_2);
4612
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4613
}
4614
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4615
if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 155, __pyx_L1_error)
4616
__pyx_v_v = ((PyObject*)__pyx_t_2);
4617
__pyx_t_2 = 0;
4618
4619
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":156
4620
* primes = primes_of_bounded_norm(bound)
4621
* cdef list v = aplist_short(A, B, primes)
4622
* if not fast_only: # <<<<<<<<<<<<<<
4623
* aplist_remaining_slow(E, v, primes)
4624
* return v
4625
*/
4626
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_fast_only); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
4627
__pyx_t_8 = ((!__pyx_t_5) != 0);
4628
if (__pyx_t_8) {
4629
4630
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":157
4631
* cdef list v = aplist_short(A, B, primes)
4632
* if not fast_only:
4633
* aplist_remaining_slow(E, v, primes) # <<<<<<<<<<<<<<
4634
* return v
4635
*
4636
*/
4637
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_aplist_remaining_slow); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error)
4638
__Pyx_GOTREF(__pyx_t_4);
4639
__pyx_t_1 = NULL;
4640
__pyx_t_7 = 0;
4641
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4642
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
4643
if (likely(__pyx_t_1)) {
4644
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4645
__Pyx_INCREF(__pyx_t_1);
4646
__Pyx_INCREF(function);
4647
__Pyx_DECREF_SET(__pyx_t_4, function);
4648
__pyx_t_7 = 1;
4649
}
4650
}
4651
#if CYTHON_FAST_PYCALL
4652
if (PyFunction_Check(__pyx_t_4)) {
4653
PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_E, __pyx_v_v, __pyx_v_primes};
4654
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
4655
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4656
__Pyx_GOTREF(__pyx_t_2);
4657
} else
4658
#endif
4659
#if CYTHON_FAST_PYCCALL
4660
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
4661
PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_E, __pyx_v_v, __pyx_v_primes};
4662
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
4663
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4664
__Pyx_GOTREF(__pyx_t_2);
4665
} else
4666
#endif
4667
{
4668
__pyx_t_3 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error)
4669
__Pyx_GOTREF(__pyx_t_3);
4670
if (__pyx_t_1) {
4671
__Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
4672
}
4673
__Pyx_INCREF(__pyx_v_E);
4674
__Pyx_GIVEREF(__pyx_v_E);
4675
PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_v_E);
4676
__Pyx_INCREF(__pyx_v_v);
4677
__Pyx_GIVEREF(__pyx_v_v);
4678
PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_v_v);
4679
__Pyx_INCREF(__pyx_v_primes);
4680
__Pyx_GIVEREF(__pyx_v_primes);
4681
PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_7, __pyx_v_primes);
4682
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
4683
__Pyx_GOTREF(__pyx_t_2);
4684
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4685
}
4686
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4687
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4688
4689
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":156
4690
* primes = primes_of_bounded_norm(bound)
4691
* cdef list v = aplist_short(A, B, primes)
4692
* if not fast_only: # <<<<<<<<<<<<<<
4693
* aplist_remaining_slow(E, v, primes)
4694
* return v
4695
*/
4696
}
4697
4698
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":158
4699
* if not fast_only:
4700
* aplist_remaining_slow(E, v, primes)
4701
* return v # <<<<<<<<<<<<<<
4702
*
4703
* def aplist_remaining_slow(E, v, primes):
4704
*/
4705
__Pyx_XDECREF(__pyx_r);
4706
__Pyx_INCREF(__pyx_v_v);
4707
__pyx_r = __pyx_v_v;
4708
goto __pyx_L0;
4709
4710
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":93
4711
* return A, B
4712
*
4713
* def aplist(E, bound, fast_only=False): # <<<<<<<<<<<<<<
4714
* """
4715
* Compute the traces of Frobenius `a_P` of the elliptic curve E over Q(sqrt(5)) for
4716
*/
4717
4718
/* function exit code */
4719
__pyx_L1_error:;
4720
__Pyx_XDECREF(__pyx_t_1);
4721
__Pyx_XDECREF(__pyx_t_2);
4722
__Pyx_XDECREF(__pyx_t_3);
4723
__Pyx_XDECREF(__pyx_t_4);
4724
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
4725
__pyx_r = NULL;
4726
__pyx_L0:;
4727
__Pyx_XDECREF(__pyx_v_A);
4728
__Pyx_XDECREF(__pyx_v_B);
4729
__Pyx_XDECREF(__pyx_v_primes);
4730
__Pyx_XDECREF(__pyx_v_v);
4731
__Pyx_XGIVEREF(__pyx_r);
4732
__Pyx_RefNannyFinishContext();
4733
return __pyx_r;
4734
}
4735
4736
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":160
4737
* return v
4738
*
4739
* def aplist_remaining_slow(E, v, primes): # <<<<<<<<<<<<<<
4740
* """
4741
* Compute -- using possibly very slow methods -- the `a_P` in the
4742
*/
4743
4744
/* Python wrapper */
4745
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_5aplist_remaining_slow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4746
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_4aplist_remaining_slow[] = "File: aplist_sqrt5.pyx (starting at line 160)\n\n Compute -- using possibly very slow methods -- the `a_P` in the\n list v that are currently set to None.\n\n Here v and primes should be two lists, where primes is a list of\n Cython Prime objects, as output by the primes_of_bounded_norm\n function. This function currently does not assume anything about\n the model of E being minimal or even integral.\n\n INPUT:\n - `E` -- elliptic curve over Q(sqrt(5))\n - `v` -- list of ints or None\n - `primes` -- list of Prime objects\n \n OUTPUT:\n - modified v in place by changing all of the None's to ints\n\n EXAMPLES::\n\n sage: from psage.ellcurve.lseries.aplist_sqrt5 import aplist\n sage: K.<a> = NumberField(x^2-x-1); E = EllipticCurve([1,-a,a,a-1,a+3])\n sage: v = aplist(E, 60, fast_only=True); v\n [None, None, None, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]\n sage: from psage.number_fields.sqrt5 import primes_of_bounded_norm\n sage: primes = primes_of_bounded_norm(60)\n sage: from psage.ellcurve.lseries.aplist_sqrt5 import aplist_remaining_slow\n sage: aplist_remaining_slow(E, v, primes); v\n [1, -2, 2, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]\n\n We can also use this (slow) function to compute all entries of v. This must give\n the same answer as above, of course::\n \n sage: v = [None]*len(primes)\n sage: aplist_remaining_slow(E, v, primes)\n sage: v\n [1, -2, 2, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]\n ";
4747
static PyMethodDef __pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_5aplist_remaining_slow = {"aplist_remaining_slow", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_5aplist_remaining_slow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_4aplist_remaining_slow};
4748
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_5aplist_remaining_slow(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4749
PyObject *__pyx_v_E = 0;
4750
PyObject *__pyx_v_v = 0;
4751
PyObject *__pyx_v_primes = 0;
4752
PyObject *__pyx_r = 0;
4753
__Pyx_RefNannyDeclarations
4754
__Pyx_RefNannySetupContext("aplist_remaining_slow (wrapper)", 0);
4755
{
4756
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_v,&__pyx_n_s_primes,0};
4757
PyObject* values[3] = {0,0,0};
4758
if (unlikely(__pyx_kwds)) {
4759
Py_ssize_t kw_args;
4760
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4761
switch (pos_args) {
4762
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4763
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4764
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4765
case 0: break;
4766
default: goto __pyx_L5_argtuple_error;
4767
}
4768
kw_args = PyDict_Size(__pyx_kwds);
4769
switch (pos_args) {
4770
case 0:
4771
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
4772
else goto __pyx_L5_argtuple_error;
4773
case 1:
4774
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
4775
else {
4776
__Pyx_RaiseArgtupleInvalid("aplist_remaining_slow", 1, 3, 3, 1); __PYX_ERR(0, 160, __pyx_L3_error)
4777
}
4778
case 2:
4779
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_primes)) != 0)) kw_args--;
4780
else {
4781
__Pyx_RaiseArgtupleInvalid("aplist_remaining_slow", 1, 3, 3, 2); __PYX_ERR(0, 160, __pyx_L3_error)
4782
}
4783
}
4784
if (unlikely(kw_args > 0)) {
4785
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aplist_remaining_slow") < 0)) __PYX_ERR(0, 160, __pyx_L3_error)
4786
}
4787
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4788
goto __pyx_L5_argtuple_error;
4789
} else {
4790
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4791
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4792
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4793
}
4794
__pyx_v_E = values[0];
4795
__pyx_v_v = values[1];
4796
__pyx_v_primes = values[2];
4797
}
4798
goto __pyx_L4_argument_unpacking_done;
4799
__pyx_L5_argtuple_error:;
4800
__Pyx_RaiseArgtupleInvalid("aplist_remaining_slow", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 160, __pyx_L3_error)
4801
__pyx_L3_error:;
4802
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist_remaining_slow", __pyx_clineno, __pyx_lineno, __pyx_filename);
4803
__Pyx_RefNannyFinishContext();
4804
return NULL;
4805
__pyx_L4_argument_unpacking_done:;
4806
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_4aplist_remaining_slow(__pyx_self, __pyx_v_E, __pyx_v_v, __pyx_v_primes);
4807
4808
/* function exit code */
4809
__Pyx_RefNannyFinishContext();
4810
return __pyx_r;
4811
}
4812
4813
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_4aplist_remaining_slow(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_E, PyObject *__pyx_v_v, PyObject *__pyx_v_primes) {
4814
Py_ssize_t __pyx_v_i;
4815
PyObject *__pyx_v_F = NULL;
4816
PyObject *__pyx_v_N = NULL;
4817
PyObject *__pyx_v_P = NULL;
4818
PyObject *__pyx_v_m = NULL;
4819
PyObject *__pyx_v_k = NULL;
4820
PyObject *__pyx_r = NULL;
4821
__Pyx_RefNannyDeclarations
4822
Py_ssize_t __pyx_t_1;
4823
Py_ssize_t __pyx_t_2;
4824
int __pyx_t_3;
4825
PyObject *__pyx_t_4 = NULL;
4826
PyObject *__pyx_t_5 = NULL;
4827
PyObject *__pyx_t_6 = NULL;
4828
int __pyx_t_7;
4829
PyObject *__pyx_t_8 = NULL;
4830
PyObject *__pyx_t_9 = NULL;
4831
PyObject *__pyx_t_10 = NULL;
4832
__Pyx_RefNannySetupContext("aplist_remaining_slow", 0);
4833
4834
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":198
4835
* [1, -2, 2, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]
4836
* """
4837
* if len(v) != len(primes): # <<<<<<<<<<<<<<
4838
* raise ValueError, "input lists v and primes must have the same length"
4839
* cdef Py_ssize_t i
4840
*/
4841
__pyx_t_1 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 198, __pyx_L1_error)
4842
__pyx_t_2 = PyObject_Length(__pyx_v_primes); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 198, __pyx_L1_error)
4843
__pyx_t_3 = ((__pyx_t_1 != __pyx_t_2) != 0);
4844
if (__pyx_t_3) {
4845
4846
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":199
4847
* """
4848
* if len(v) != len(primes):
4849
* raise ValueError, "input lists v and primes must have the same length" # <<<<<<<<<<<<<<
4850
* cdef Py_ssize_t i
4851
* F = E.global_minimal_model()
4852
*/
4853
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_input_lists_v_and_primes_must_ha, 0, 0);
4854
__PYX_ERR(0, 199, __pyx_L1_error)
4855
4856
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":198
4857
* [1, -2, 2, -4, -2, 0, -5, 0, -5, 0, 2, 11, 12, 10, -11, -6]
4858
* """
4859
* if len(v) != len(primes): # <<<<<<<<<<<<<<
4860
* raise ValueError, "input lists v and primes must have the same length"
4861
* cdef Py_ssize_t i
4862
*/
4863
}
4864
4865
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":201
4866
* raise ValueError, "input lists v and primes must have the same length"
4867
* cdef Py_ssize_t i
4868
* F = E.global_minimal_model() # <<<<<<<<<<<<<<
4869
* N = F.conductor()
4870
* for i in range(len(v)):
4871
*/
4872
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_E, __pyx_n_s_global_minimal_model); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
4873
__Pyx_GOTREF(__pyx_t_5);
4874
__pyx_t_6 = NULL;
4875
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
4876
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
4877
if (likely(__pyx_t_6)) {
4878
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4879
__Pyx_INCREF(__pyx_t_6);
4880
__Pyx_INCREF(function);
4881
__Pyx_DECREF_SET(__pyx_t_5, function);
4882
}
4883
}
4884
if (__pyx_t_6) {
4885
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
4886
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4887
} else {
4888
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
4889
}
4890
__Pyx_GOTREF(__pyx_t_4);
4891
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4892
__pyx_v_F = __pyx_t_4;
4893
__pyx_t_4 = 0;
4894
4895
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":202
4896
* cdef Py_ssize_t i
4897
* F = E.global_minimal_model()
4898
* N = F.conductor() # <<<<<<<<<<<<<<
4899
* for i in range(len(v)):
4900
* if v[i] is None:
4901
*/
4902
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_conductor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
4903
__Pyx_GOTREF(__pyx_t_5);
4904
__pyx_t_6 = NULL;
4905
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
4906
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
4907
if (likely(__pyx_t_6)) {
4908
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4909
__Pyx_INCREF(__pyx_t_6);
4910
__Pyx_INCREF(function);
4911
__Pyx_DECREF_SET(__pyx_t_5, function);
4912
}
4913
}
4914
if (__pyx_t_6) {
4915
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
4916
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4917
} else {
4918
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
4919
}
4920
__Pyx_GOTREF(__pyx_t_4);
4921
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4922
__pyx_v_N = __pyx_t_4;
4923
__pyx_t_4 = 0;
4924
4925
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":203
4926
* F = E.global_minimal_model()
4927
* N = F.conductor()
4928
* for i in range(len(v)): # <<<<<<<<<<<<<<
4929
* if v[i] is None:
4930
* P = primes[i].sage_ideal()
4931
*/
4932
__pyx_t_2 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 203, __pyx_L1_error)
4933
for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) {
4934
__pyx_v_i = __pyx_t_1;
4935
4936
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":204
4937
* N = F.conductor()
4938
* for i in range(len(v)):
4939
* if v[i] is None: # <<<<<<<<<<<<<<
4940
* P = primes[i].sage_ideal()
4941
* m = N.valuation(P)
4942
*/
4943
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_v, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
4944
__Pyx_GOTREF(__pyx_t_4);
4945
__pyx_t_3 = (__pyx_t_4 == Py_None);
4946
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4947
__pyx_t_7 = (__pyx_t_3 != 0);
4948
if (__pyx_t_7) {
4949
4950
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":205
4951
* for i in range(len(v)):
4952
* if v[i] is None:
4953
* P = primes[i].sage_ideal() # <<<<<<<<<<<<<<
4954
* m = N.valuation(P)
4955
* if m >= 2:
4956
*/
4957
__pyx_t_5 = __Pyx_GetItemInt(__pyx_v_primes, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
4958
__Pyx_GOTREF(__pyx_t_5);
4959
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sage_ideal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error)
4960
__Pyx_GOTREF(__pyx_t_6);
4961
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4962
__pyx_t_5 = NULL;
4963
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
4964
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
4965
if (likely(__pyx_t_5)) {
4966
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4967
__Pyx_INCREF(__pyx_t_5);
4968
__Pyx_INCREF(function);
4969
__Pyx_DECREF_SET(__pyx_t_6, function);
4970
}
4971
}
4972
if (__pyx_t_5) {
4973
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
4974
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4975
} else {
4976
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
4977
}
4978
__Pyx_GOTREF(__pyx_t_4);
4979
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4980
__Pyx_XDECREF_SET(__pyx_v_P, __pyx_t_4);
4981
__pyx_t_4 = 0;
4982
4983
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":206
4984
* if v[i] is None:
4985
* P = primes[i].sage_ideal()
4986
* m = N.valuation(P) # <<<<<<<<<<<<<<
4987
* if m >= 2:
4988
* v[i] = 0
4989
*/
4990
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_N, __pyx_n_s_valuation); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
4991
__Pyx_GOTREF(__pyx_t_6);
4992
__pyx_t_5 = NULL;
4993
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
4994
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
4995
if (likely(__pyx_t_5)) {
4996
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4997
__Pyx_INCREF(__pyx_t_5);
4998
__Pyx_INCREF(function);
4999
__Pyx_DECREF_SET(__pyx_t_6, function);
5000
}
5001
}
5002
if (!__pyx_t_5) {
5003
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_P); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
5004
__Pyx_GOTREF(__pyx_t_4);
5005
} else {
5006
#if CYTHON_FAST_PYCALL
5007
if (PyFunction_Check(__pyx_t_6)) {
5008
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_P};
5009
__pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
5010
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5011
__Pyx_GOTREF(__pyx_t_4);
5012
} else
5013
#endif
5014
#if CYTHON_FAST_PYCCALL
5015
if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
5016
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_P};
5017
__pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
5018
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5019
__Pyx_GOTREF(__pyx_t_4);
5020
} else
5021
#endif
5022
{
5023
__pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L1_error)
5024
__Pyx_GOTREF(__pyx_t_8);
5025
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
5026
__Pyx_INCREF(__pyx_v_P);
5027
__Pyx_GIVEREF(__pyx_v_P);
5028
PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_P);
5029
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
5030
__Pyx_GOTREF(__pyx_t_4);
5031
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5032
}
5033
}
5034
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5035
__Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_4);
5036
__pyx_t_4 = 0;
5037
5038
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":207
5039
* P = primes[i].sage_ideal()
5040
* m = N.valuation(P)
5041
* if m >= 2: # <<<<<<<<<<<<<<
5042
* v[i] = 0
5043
* elif m == 1:
5044
*/
5045
__pyx_t_4 = PyObject_RichCompare(__pyx_v_m, __pyx_int_2, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
5046
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
5047
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5048
if (__pyx_t_7) {
5049
5050
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":208
5051
* m = N.valuation(P)
5052
* if m >= 2:
5053
* v[i] = 0 # <<<<<<<<<<<<<<
5054
* elif m == 1:
5055
* if F.has_split_multiplicative_reduction(P):
5056
*/
5057
if (unlikely(__Pyx_SetItemInt(__pyx_v_v, __pyx_v_i, __pyx_int_0, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
5058
5059
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":207
5060
* P = primes[i].sage_ideal()
5061
* m = N.valuation(P)
5062
* if m >= 2: # <<<<<<<<<<<<<<
5063
* v[i] = 0
5064
* elif m == 1:
5065
*/
5066
goto __pyx_L7;
5067
}
5068
5069
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":209
5070
* if m >= 2:
5071
* v[i] = 0
5072
* elif m == 1: # <<<<<<<<<<<<<<
5073
* if F.has_split_multiplicative_reduction(P):
5074
* v[i] = 1
5075
*/
5076
__pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_m, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
5077
__Pyx_GOTREF(__pyx_t_4);
5078
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 209, __pyx_L1_error)
5079
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5080
if (__pyx_t_7) {
5081
5082
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":210
5083
* v[i] = 0
5084
* elif m == 1:
5085
* if F.has_split_multiplicative_reduction(P): # <<<<<<<<<<<<<<
5086
* v[i] = 1
5087
* else:
5088
*/
5089
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_has_split_multiplicative_reducti); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error)
5090
__Pyx_GOTREF(__pyx_t_6);
5091
__pyx_t_8 = NULL;
5092
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
5093
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
5094
if (likely(__pyx_t_8)) {
5095
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5096
__Pyx_INCREF(__pyx_t_8);
5097
__Pyx_INCREF(function);
5098
__Pyx_DECREF_SET(__pyx_t_6, function);
5099
}
5100
}
5101
if (!__pyx_t_8) {
5102
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_P); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
5103
__Pyx_GOTREF(__pyx_t_4);
5104
} else {
5105
#if CYTHON_FAST_PYCALL
5106
if (PyFunction_Check(__pyx_t_6)) {
5107
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_P};
5108
__pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
5109
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5110
__Pyx_GOTREF(__pyx_t_4);
5111
} else
5112
#endif
5113
#if CYTHON_FAST_PYCCALL
5114
if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
5115
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_P};
5116
__pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
5117
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5118
__Pyx_GOTREF(__pyx_t_4);
5119
} else
5120
#endif
5121
{
5122
__pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 210, __pyx_L1_error)
5123
__Pyx_GOTREF(__pyx_t_5);
5124
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
5125
__Pyx_INCREF(__pyx_v_P);
5126
__Pyx_GIVEREF(__pyx_v_P);
5127
PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_P);
5128
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
5129
__Pyx_GOTREF(__pyx_t_4);
5130
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5131
}
5132
}
5133
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5134
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 210, __pyx_L1_error)
5135
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5136
if (__pyx_t_7) {
5137
5138
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":211
5139
* elif m == 1:
5140
* if F.has_split_multiplicative_reduction(P):
5141
* v[i] = 1 # <<<<<<<<<<<<<<
5142
* else:
5143
* v[i] = -1
5144
*/
5145
if (unlikely(__Pyx_SetItemInt(__pyx_v_v, __pyx_v_i, __pyx_int_1, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 211, __pyx_L1_error)
5146
5147
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":210
5148
* v[i] = 0
5149
* elif m == 1:
5150
* if F.has_split_multiplicative_reduction(P): # <<<<<<<<<<<<<<
5151
* v[i] = 1
5152
* else:
5153
*/
5154
goto __pyx_L8;
5155
}
5156
5157
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":213
5158
* v[i] = 1
5159
* else:
5160
* v[i] = -1 # <<<<<<<<<<<<<<
5161
* else:
5162
* k = P.residue_field()
5163
*/
5164
/*else*/ {
5165
if (unlikely(__Pyx_SetItemInt(__pyx_v_v, __pyx_v_i, __pyx_int_neg_1, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 213, __pyx_L1_error)
5166
}
5167
__pyx_L8:;
5168
5169
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":209
5170
* if m >= 2:
5171
* v[i] = 0
5172
* elif m == 1: # <<<<<<<<<<<<<<
5173
* if F.has_split_multiplicative_reduction(P):
5174
* v[i] = 1
5175
*/
5176
goto __pyx_L7;
5177
}
5178
5179
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":215
5180
* v[i] = -1
5181
* else:
5182
* k = P.residue_field() # <<<<<<<<<<<<<<
5183
* v[i] = k.cardinality() + 1 - F.change_ring(k).cardinality()
5184
*
5185
*/
5186
/*else*/ {
5187
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_P, __pyx_n_s_residue_field); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error)
5188
__Pyx_GOTREF(__pyx_t_6);
5189
__pyx_t_5 = NULL;
5190
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
5191
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
5192
if (likely(__pyx_t_5)) {
5193
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5194
__Pyx_INCREF(__pyx_t_5);
5195
__Pyx_INCREF(function);
5196
__Pyx_DECREF_SET(__pyx_t_6, function);
5197
}
5198
}
5199
if (__pyx_t_5) {
5200
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
5201
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5202
} else {
5203
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
5204
}
5205
__Pyx_GOTREF(__pyx_t_4);
5206
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5207
__Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_4);
5208
__pyx_t_4 = 0;
5209
5210
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":216
5211
* else:
5212
* k = P.residue_field()
5213
* v[i] = k.cardinality() + 1 - F.change_ring(k).cardinality() # <<<<<<<<<<<<<<
5214
*
5215
* def aplist_short(A, B, primes):
5216
*/
5217
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_k, __pyx_n_s_cardinality); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 216, __pyx_L1_error)
5218
__Pyx_GOTREF(__pyx_t_6);
5219
__pyx_t_5 = NULL;
5220
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
5221
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
5222
if (likely(__pyx_t_5)) {
5223
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5224
__Pyx_INCREF(__pyx_t_5);
5225
__Pyx_INCREF(function);
5226
__Pyx_DECREF_SET(__pyx_t_6, function);
5227
}
5228
}
5229
if (__pyx_t_5) {
5230
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
5231
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5232
} else {
5233
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
5234
}
5235
__Pyx_GOTREF(__pyx_t_4);
5236
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5237
__pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 216, __pyx_L1_error)
5238
__Pyx_GOTREF(__pyx_t_6);
5239
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5240
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_change_ring); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error)
5241
__Pyx_GOTREF(__pyx_t_8);
5242
__pyx_t_9 = NULL;
5243
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
5244
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
5245
if (likely(__pyx_t_9)) {
5246
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5247
__Pyx_INCREF(__pyx_t_9);
5248
__Pyx_INCREF(function);
5249
__Pyx_DECREF_SET(__pyx_t_8, function);
5250
}
5251
}
5252
if (!__pyx_t_9) {
5253
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
5254
__Pyx_GOTREF(__pyx_t_5);
5255
} else {
5256
#if CYTHON_FAST_PYCALL
5257
if (PyFunction_Check(__pyx_t_8)) {
5258
PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_k};
5259
__pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
5260
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5261
__Pyx_GOTREF(__pyx_t_5);
5262
} else
5263
#endif
5264
#if CYTHON_FAST_PYCCALL
5265
if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
5266
PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_k};
5267
__pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
5268
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5269
__Pyx_GOTREF(__pyx_t_5);
5270
} else
5271
#endif
5272
{
5273
__pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 216, __pyx_L1_error)
5274
__Pyx_GOTREF(__pyx_t_10);
5275
__Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
5276
__Pyx_INCREF(__pyx_v_k);
5277
__Pyx_GIVEREF(__pyx_v_k);
5278
PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_k);
5279
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
5280
__Pyx_GOTREF(__pyx_t_5);
5281
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5282
}
5283
}
5284
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5285
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_cardinality); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error)
5286
__Pyx_GOTREF(__pyx_t_8);
5287
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5288
__pyx_t_5 = NULL;
5289
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
5290
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
5291
if (likely(__pyx_t_5)) {
5292
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
5293
__Pyx_INCREF(__pyx_t_5);
5294
__Pyx_INCREF(function);
5295
__Pyx_DECREF_SET(__pyx_t_8, function);
5296
}
5297
}
5298
if (__pyx_t_5) {
5299
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
5300
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5301
} else {
5302
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
5303
}
5304
__Pyx_GOTREF(__pyx_t_4);
5305
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5306
__pyx_t_8 = PyNumber_Subtract(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error)
5307
__Pyx_GOTREF(__pyx_t_8);
5308
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5309
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5310
if (unlikely(__Pyx_SetItemInt(__pyx_v_v, __pyx_v_i, __pyx_t_8, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 216, __pyx_L1_error)
5311
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5312
}
5313
__pyx_L7:;
5314
5315
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":204
5316
* N = F.conductor()
5317
* for i in range(len(v)):
5318
* if v[i] is None: # <<<<<<<<<<<<<<
5319
* P = primes[i].sage_ideal()
5320
* m = N.valuation(P)
5321
*/
5322
}
5323
}
5324
5325
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":160
5326
* return v
5327
*
5328
* def aplist_remaining_slow(E, v, primes): # <<<<<<<<<<<<<<
5329
* """
5330
* Compute -- using possibly very slow methods -- the `a_P` in the
5331
*/
5332
5333
/* function exit code */
5334
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5335
goto __pyx_L0;
5336
__pyx_L1_error:;
5337
__Pyx_XDECREF(__pyx_t_4);
5338
__Pyx_XDECREF(__pyx_t_5);
5339
__Pyx_XDECREF(__pyx_t_6);
5340
__Pyx_XDECREF(__pyx_t_8);
5341
__Pyx_XDECREF(__pyx_t_9);
5342
__Pyx_XDECREF(__pyx_t_10);
5343
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist_remaining_slow", __pyx_clineno, __pyx_lineno, __pyx_filename);
5344
__pyx_r = NULL;
5345
__pyx_L0:;
5346
__Pyx_XDECREF(__pyx_v_F);
5347
__Pyx_XDECREF(__pyx_v_N);
5348
__Pyx_XDECREF(__pyx_v_P);
5349
__Pyx_XDECREF(__pyx_v_m);
5350
__Pyx_XDECREF(__pyx_v_k);
5351
__Pyx_XGIVEREF(__pyx_r);
5352
__Pyx_RefNannyFinishContext();
5353
return __pyx_r;
5354
}
5355
5356
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":218
5357
* v[i] = k.cardinality() + 1 - F.change_ring(k).cardinality()
5358
*
5359
* def aplist_short(A, B, primes): # <<<<<<<<<<<<<<
5360
* """
5361
* Return list of `a_P` values that can be quickly computed for the
5362
*/
5363
5364
/* Python wrapper */
5365
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_7aplist_short(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5366
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_6aplist_short[] = "File: aplist_sqrt5.pyx (starting at line 218)\n\n Return list of `a_P` values that can be quickly computed for the\n elliptic curve `y^2=x^3+AX+B` and the given list of primes. See\n the important warnings in the INPUT section below.\n \n INPUT:\n - A, B -- algebraic integers in Q(sqrt(5)), which we assume\n (without checking!) is defined by the polynomial `x^2-x-1`.\n If you violate this assumption, you will get nonsense.\n - ``primes`` -- list of Prime objects\n OUTPUT:\n - list of ints or None\n\n EXAMPLES::\n\n sage: from psage.ellcurve.lseries.aplist_sqrt5 import aplist_short\n sage: from psage.number_fields.sqrt5 import primes_of_bounded_norm\n sage: K.<a> = NumberField(x^2-x-1)\n sage: aplist_short(2*a+5, 3*a-7, primes_of_bounded_norm(100))\n [None, None, None, 2, None, 2, 0, -6, -6, -4, -8, 3, 1, 10, -10, 0, 0, -4, -3, -16, 14, -8, 8, 15]\n ";
5367
static PyMethodDef __pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_7aplist_short = {"aplist_short", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_7aplist_short, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_6aplist_short};
5368
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_7aplist_short(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5369
PyObject *__pyx_v_A = 0;
5370
PyObject *__pyx_v_B = 0;
5371
PyObject *__pyx_v_primes = 0;
5372
PyObject *__pyx_r = 0;
5373
__Pyx_RefNannyDeclarations
5374
__Pyx_RefNannySetupContext("aplist_short (wrapper)", 0);
5375
{
5376
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_primes,0};
5377
PyObject* values[3] = {0,0,0};
5378
if (unlikely(__pyx_kwds)) {
5379
Py_ssize_t kw_args;
5380
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5381
switch (pos_args) {
5382
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5383
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5384
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5385
case 0: break;
5386
default: goto __pyx_L5_argtuple_error;
5387
}
5388
kw_args = PyDict_Size(__pyx_kwds);
5389
switch (pos_args) {
5390
case 0:
5391
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
5392
else goto __pyx_L5_argtuple_error;
5393
case 1:
5394
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
5395
else {
5396
__Pyx_RaiseArgtupleInvalid("aplist_short", 1, 3, 3, 1); __PYX_ERR(0, 218, __pyx_L3_error)
5397
}
5398
case 2:
5399
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_primes)) != 0)) kw_args--;
5400
else {
5401
__Pyx_RaiseArgtupleInvalid("aplist_short", 1, 3, 3, 2); __PYX_ERR(0, 218, __pyx_L3_error)
5402
}
5403
}
5404
if (unlikely(kw_args > 0)) {
5405
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aplist_short") < 0)) __PYX_ERR(0, 218, __pyx_L3_error)
5406
}
5407
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5408
goto __pyx_L5_argtuple_error;
5409
} else {
5410
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5411
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5412
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5413
}
5414
__pyx_v_A = values[0];
5415
__pyx_v_B = values[1];
5416
__pyx_v_primes = values[2];
5417
}
5418
goto __pyx_L4_argument_unpacking_done;
5419
__pyx_L5_argtuple_error:;
5420
__Pyx_RaiseArgtupleInvalid("aplist_short", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 218, __pyx_L3_error)
5421
__pyx_L3_error:;
5422
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist_short", __pyx_clineno, __pyx_lineno, __pyx_filename);
5423
__Pyx_RefNannyFinishContext();
5424
return NULL;
5425
__pyx_L4_argument_unpacking_done:;
5426
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_6aplist_short(__pyx_self, __pyx_v_A, __pyx_v_B, __pyx_v_primes);
5427
5428
/* function exit code */
5429
__Pyx_RefNannyFinishContext();
5430
return __pyx_r;
5431
}
5432
5433
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_6aplist_short(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_primes) {
5434
mpz_t __pyx_v_Ax;
5435
mpz_t __pyx_v_Ay;
5436
mpz_t __pyx_v_Bx;
5437
mpz_t __pyx_v_By;
5438
PyObject *__pyx_v_v = NULL;
5439
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_z = 0;
5440
int __pyx_v_N;
5441
PyObject *__pyx_r = NULL;
5442
__Pyx_RefNannyDeclarations
5443
PyObject *__pyx_t_1 = NULL;
5444
PyObject *__pyx_t_2 = NULL;
5445
PyObject *__pyx_t_3 = NULL;
5446
PyObject *__pyx_t_4 = NULL;
5447
PyObject *__pyx_t_5 = NULL;
5448
PyObject *__pyx_t_6 = NULL;
5449
Py_ssize_t __pyx_t_7;
5450
int __pyx_t_8;
5451
__Pyx_RefNannySetupContext("aplist_short", 0);
5452
5453
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":243
5454
* # where (Ax,Ay) <--> Ax + Ay * (1+sqrt(5))/2.
5455
* cdef mpz_t Ax, Ay, Bx, By
5456
* mpz_init(Ax); mpz_init(Ay); mpz_init(Bx); mpz_init(By) # <<<<<<<<<<<<<<
5457
* v = A._coefficients() # slow
5458
* cdef Integer z
5459
*/
5460
mpz_init(__pyx_v_Ax);
5461
mpz_init(__pyx_v_Ay);
5462
mpz_init(__pyx_v_Bx);
5463
mpz_init(__pyx_v_By);
5464
5465
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":244
5466
* cdef mpz_t Ax, Ay, Bx, By
5467
* mpz_init(Ax); mpz_init(Ay); mpz_init(Bx); mpz_init(By)
5468
* v = A._coefficients() # slow # <<<<<<<<<<<<<<
5469
* cdef Integer z
5470
* cdef int N
5471
*/
5472
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_coefficients); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
5473
__Pyx_GOTREF(__pyx_t_2);
5474
__pyx_t_3 = NULL;
5475
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5476
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5477
if (likely(__pyx_t_3)) {
5478
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5479
__Pyx_INCREF(__pyx_t_3);
5480
__Pyx_INCREF(function);
5481
__Pyx_DECREF_SET(__pyx_t_2, function);
5482
}
5483
}
5484
if (__pyx_t_3) {
5485
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
5486
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5487
} else {
5488
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
5489
}
5490
__Pyx_GOTREF(__pyx_t_1);
5491
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5492
__pyx_v_v = __pyx_t_1;
5493
__pyx_t_1 = 0;
5494
5495
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":247
5496
* cdef Integer z
5497
* cdef int N
5498
* try: # <<<<<<<<<<<<<<
5499
* N = len(v)
5500
* if N == 0:
5501
*/
5502
{
5503
__Pyx_PyThreadState_declare
5504
__Pyx_PyThreadState_assign
5505
__Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
5506
__Pyx_XGOTREF(__pyx_t_4);
5507
__Pyx_XGOTREF(__pyx_t_5);
5508
__Pyx_XGOTREF(__pyx_t_6);
5509
/*try:*/ {
5510
5511
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":248
5512
* cdef int N
5513
* try:
5514
* N = len(v) # <<<<<<<<<<<<<<
5515
* if N == 0:
5516
* mpz_set_si(Ax, 0)
5517
*/
5518
__pyx_t_7 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 248, __pyx_L3_error)
5519
__pyx_v_N = __pyx_t_7;
5520
5521
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":249
5522
* try:
5523
* N = len(v)
5524
* if N == 0: # <<<<<<<<<<<<<<
5525
* mpz_set_si(Ax, 0)
5526
* mpz_set_si(Ay, 0)
5527
*/
5528
switch (__pyx_v_N) {
5529
case 0:
5530
5531
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":250
5532
* N = len(v)
5533
* if N == 0:
5534
* mpz_set_si(Ax, 0) # <<<<<<<<<<<<<<
5535
* mpz_set_si(Ay, 0)
5536
* elif N == 1:
5537
*/
5538
mpz_set_si(__pyx_v_Ax, 0);
5539
5540
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":251
5541
* if N == 0:
5542
* mpz_set_si(Ax, 0)
5543
* mpz_set_si(Ay, 0) # <<<<<<<<<<<<<<
5544
* elif N == 1:
5545
* z = Integer(v[0]); mpz_set(Ax, z.value)
5546
*/
5547
mpz_set_si(__pyx_v_Ay, 0);
5548
5549
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":249
5550
* try:
5551
* N = len(v)
5552
* if N == 0: # <<<<<<<<<<<<<<
5553
* mpz_set_si(Ax, 0)
5554
* mpz_set_si(Ay, 0)
5555
*/
5556
break;
5557
5558
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":252
5559
* mpz_set_si(Ax, 0)
5560
* mpz_set_si(Ay, 0)
5561
* elif N == 1: # <<<<<<<<<<<<<<
5562
* z = Integer(v[0]); mpz_set(Ax, z.value)
5563
* mpz_set_si(Ay, 0)
5564
*/
5565
case 1:
5566
5567
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":253
5568
* mpz_set_si(Ay, 0)
5569
* elif N == 1:
5570
* z = Integer(v[0]); mpz_set(Ax, z.value) # <<<<<<<<<<<<<<
5571
* mpz_set_si(Ay, 0)
5572
* else:
5573
*/
5574
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L3_error)
5575
__Pyx_GOTREF(__pyx_t_1);
5576
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L3_error)
5577
__Pyx_GOTREF(__pyx_t_2);
5578
__Pyx_GIVEREF(__pyx_t_1);
5579
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5580
__pyx_t_1 = 0;
5581
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L3_error)
5582
__Pyx_GOTREF(__pyx_t_1);
5583
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5584
__pyx_v_z = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1);
5585
__pyx_t_1 = 0;
5586
mpz_set(__pyx_v_Ax, __pyx_v_z->value);
5587
5588
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":254
5589
* elif N == 1:
5590
* z = Integer(v[0]); mpz_set(Ax, z.value)
5591
* mpz_set_si(Ay, 0) # <<<<<<<<<<<<<<
5592
* else:
5593
* z = Integer(v[0]); mpz_set(Ax, z.value)
5594
*/
5595
mpz_set_si(__pyx_v_Ay, 0);
5596
5597
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":252
5598
* mpz_set_si(Ax, 0)
5599
* mpz_set_si(Ay, 0)
5600
* elif N == 1: # <<<<<<<<<<<<<<
5601
* z = Integer(v[0]); mpz_set(Ax, z.value)
5602
* mpz_set_si(Ay, 0)
5603
*/
5604
break;
5605
default:
5606
5607
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":256
5608
* mpz_set_si(Ay, 0)
5609
* else:
5610
* z = Integer(v[0]); mpz_set(Ax, z.value) # <<<<<<<<<<<<<<
5611
* z = Integer(v[1]); mpz_set(Ay, z.value)
5612
* v = B._coefficients()
5613
*/
5614
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L3_error)
5615
__Pyx_GOTREF(__pyx_t_1);
5616
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L3_error)
5617
__Pyx_GOTREF(__pyx_t_2);
5618
__Pyx_GIVEREF(__pyx_t_1);
5619
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5620
__pyx_t_1 = 0;
5621
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L3_error)
5622
__Pyx_GOTREF(__pyx_t_1);
5623
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5624
__pyx_v_z = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1);
5625
__pyx_t_1 = 0;
5626
mpz_set(__pyx_v_Ax, __pyx_v_z->value);
5627
5628
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":257
5629
* else:
5630
* z = Integer(v[0]); mpz_set(Ax, z.value)
5631
* z = Integer(v[1]); mpz_set(Ay, z.value) # <<<<<<<<<<<<<<
5632
* v = B._coefficients()
5633
* N = len(v)
5634
*/
5635
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_v, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L3_error)
5636
__Pyx_GOTREF(__pyx_t_1);
5637
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L3_error)
5638
__Pyx_GOTREF(__pyx_t_2);
5639
__Pyx_GIVEREF(__pyx_t_1);
5640
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5641
__pyx_t_1 = 0;
5642
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L3_error)
5643
__Pyx_GOTREF(__pyx_t_1);
5644
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5645
__Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1));
5646
__pyx_t_1 = 0;
5647
mpz_set(__pyx_v_Ay, __pyx_v_z->value);
5648
break;
5649
}
5650
5651
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":258
5652
* z = Integer(v[0]); mpz_set(Ax, z.value)
5653
* z = Integer(v[1]); mpz_set(Ay, z.value)
5654
* v = B._coefficients() # <<<<<<<<<<<<<<
5655
* N = len(v)
5656
* if N == 0:
5657
*/
5658
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_B, __pyx_n_s_coefficients); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L3_error)
5659
__Pyx_GOTREF(__pyx_t_2);
5660
__pyx_t_3 = NULL;
5661
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5662
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5663
if (likely(__pyx_t_3)) {
5664
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5665
__Pyx_INCREF(__pyx_t_3);
5666
__Pyx_INCREF(function);
5667
__Pyx_DECREF_SET(__pyx_t_2, function);
5668
}
5669
}
5670
if (__pyx_t_3) {
5671
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L3_error)
5672
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5673
} else {
5674
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L3_error)
5675
}
5676
__Pyx_GOTREF(__pyx_t_1);
5677
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5678
__Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
5679
__pyx_t_1 = 0;
5680
5681
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":259
5682
* z = Integer(v[1]); mpz_set(Ay, z.value)
5683
* v = B._coefficients()
5684
* N = len(v) # <<<<<<<<<<<<<<
5685
* if N == 0:
5686
* mpz_set_si(Bx, 0)
5687
*/
5688
__pyx_t_7 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 259, __pyx_L3_error)
5689
__pyx_v_N = __pyx_t_7;
5690
5691
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":260
5692
* v = B._coefficients()
5693
* N = len(v)
5694
* if N == 0: # <<<<<<<<<<<<<<
5695
* mpz_set_si(Bx, 0)
5696
* mpz_set_si(By, 0)
5697
*/
5698
switch (__pyx_v_N) {
5699
case 0:
5700
5701
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":261
5702
* N = len(v)
5703
* if N == 0:
5704
* mpz_set_si(Bx, 0) # <<<<<<<<<<<<<<
5705
* mpz_set_si(By, 0)
5706
* elif N == 1:
5707
*/
5708
mpz_set_si(__pyx_v_Bx, 0);
5709
5710
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":262
5711
* if N == 0:
5712
* mpz_set_si(Bx, 0)
5713
* mpz_set_si(By, 0) # <<<<<<<<<<<<<<
5714
* elif N == 1:
5715
* z = Integer(v[0]); mpz_set(Bx, z.value)
5716
*/
5717
mpz_set_si(__pyx_v_By, 0);
5718
5719
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":260
5720
* v = B._coefficients()
5721
* N = len(v)
5722
* if N == 0: # <<<<<<<<<<<<<<
5723
* mpz_set_si(Bx, 0)
5724
* mpz_set_si(By, 0)
5725
*/
5726
break;
5727
5728
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":263
5729
* mpz_set_si(Bx, 0)
5730
* mpz_set_si(By, 0)
5731
* elif N == 1: # <<<<<<<<<<<<<<
5732
* z = Integer(v[0]); mpz_set(Bx, z.value)
5733
* mpz_set_si(By, 0)
5734
*/
5735
case 1:
5736
5737
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":264
5738
* mpz_set_si(By, 0)
5739
* elif N == 1:
5740
* z = Integer(v[0]); mpz_set(Bx, z.value) # <<<<<<<<<<<<<<
5741
* mpz_set_si(By, 0)
5742
* else:
5743
*/
5744
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L3_error)
5745
__Pyx_GOTREF(__pyx_t_1);
5746
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L3_error)
5747
__Pyx_GOTREF(__pyx_t_2);
5748
__Pyx_GIVEREF(__pyx_t_1);
5749
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5750
__pyx_t_1 = 0;
5751
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L3_error)
5752
__Pyx_GOTREF(__pyx_t_1);
5753
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5754
__Pyx_XDECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1));
5755
__pyx_t_1 = 0;
5756
mpz_set(__pyx_v_Bx, __pyx_v_z->value);
5757
5758
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":265
5759
* elif N == 1:
5760
* z = Integer(v[0]); mpz_set(Bx, z.value)
5761
* mpz_set_si(By, 0) # <<<<<<<<<<<<<<
5762
* else:
5763
* z = Integer(v[0]); mpz_set(Bx, z.value)
5764
*/
5765
mpz_set_si(__pyx_v_By, 0);
5766
5767
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":263
5768
* mpz_set_si(Bx, 0)
5769
* mpz_set_si(By, 0)
5770
* elif N == 1: # <<<<<<<<<<<<<<
5771
* z = Integer(v[0]); mpz_set(Bx, z.value)
5772
* mpz_set_si(By, 0)
5773
*/
5774
break;
5775
default:
5776
5777
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":267
5778
* mpz_set_si(By, 0)
5779
* else:
5780
* z = Integer(v[0]); mpz_set(Bx, z.value) # <<<<<<<<<<<<<<
5781
* z = Integer(v[1]); mpz_set(By, z.value)
5782
* except TypeError:
5783
*/
5784
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L3_error)
5785
__Pyx_GOTREF(__pyx_t_1);
5786
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L3_error)
5787
__Pyx_GOTREF(__pyx_t_2);
5788
__Pyx_GIVEREF(__pyx_t_1);
5789
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5790
__pyx_t_1 = 0;
5791
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L3_error)
5792
__Pyx_GOTREF(__pyx_t_1);
5793
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5794
__Pyx_XDECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1));
5795
__pyx_t_1 = 0;
5796
mpz_set(__pyx_v_Bx, __pyx_v_z->value);
5797
5798
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":268
5799
* else:
5800
* z = Integer(v[0]); mpz_set(Bx, z.value)
5801
* z = Integer(v[1]); mpz_set(By, z.value) # <<<<<<<<<<<<<<
5802
* except TypeError:
5803
* raise ValueError, "coefficients of the input curve must be algebraic integers"
5804
*/
5805
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_v, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L3_error)
5806
__Pyx_GOTREF(__pyx_t_1);
5807
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L3_error)
5808
__Pyx_GOTREF(__pyx_t_2);
5809
__Pyx_GIVEREF(__pyx_t_1);
5810
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5811
__pyx_t_1 = 0;
5812
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L3_error)
5813
__Pyx_GOTREF(__pyx_t_1);
5814
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5815
__Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_1));
5816
__pyx_t_1 = 0;
5817
mpz_set(__pyx_v_By, __pyx_v_z->value);
5818
break;
5819
}
5820
5821
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":247
5822
* cdef Integer z
5823
* cdef int N
5824
* try: # <<<<<<<<<<<<<<
5825
* N = len(v)
5826
* if N == 0:
5827
*/
5828
}
5829
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5830
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5831
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5832
goto __pyx_L10_try_end;
5833
__pyx_L3_error:;
5834
__Pyx_PyThreadState_assign
5835
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5836
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5837
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5838
5839
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":269
5840
* z = Integer(v[0]); mpz_set(Bx, z.value)
5841
* z = Integer(v[1]); mpz_set(By, z.value)
5842
* except TypeError: # <<<<<<<<<<<<<<
5843
* raise ValueError, "coefficients of the input curve must be algebraic integers"
5844
*
5845
*/
5846
__pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
5847
if (__pyx_t_8) {
5848
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist_short", __pyx_clineno, __pyx_lineno, __pyx_filename);
5849
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 269, __pyx_L5_except_error)
5850
__Pyx_GOTREF(__pyx_t_1);
5851
__Pyx_GOTREF(__pyx_t_2);
5852
__Pyx_GOTREF(__pyx_t_3);
5853
5854
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":270
5855
* z = Integer(v[1]); mpz_set(By, z.value)
5856
* except TypeError:
5857
* raise ValueError, "coefficients of the input curve must be algebraic integers" # <<<<<<<<<<<<<<
5858
*
5859
* v = compute_ap(Ax, Ay, Bx, By, primes)
5860
*/
5861
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_coefficients_of_the_input_curve, 0, 0);
5862
__PYX_ERR(0, 270, __pyx_L5_except_error)
5863
}
5864
goto __pyx_L5_except_error;
5865
__pyx_L5_except_error:;
5866
5867
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":247
5868
* cdef Integer z
5869
* cdef int N
5870
* try: # <<<<<<<<<<<<<<
5871
* N = len(v)
5872
* if N == 0:
5873
*/
5874
__Pyx_PyThreadState_assign
5875
__Pyx_XGIVEREF(__pyx_t_4);
5876
__Pyx_XGIVEREF(__pyx_t_5);
5877
__Pyx_XGIVEREF(__pyx_t_6);
5878
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
5879
goto __pyx_L1_error;
5880
__pyx_L10_try_end:;
5881
}
5882
5883
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":272
5884
* raise ValueError, "coefficients of the input curve must be algebraic integers"
5885
*
5886
* v = compute_ap(Ax, Ay, Bx, By, primes) # <<<<<<<<<<<<<<
5887
*
5888
* mpz_clear(Ax); mpz_clear(Ay); mpz_clear(Bx); mpz_clear(By)
5889
*/
5890
__pyx_t_3 = __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_ap(__pyx_v_Ax, __pyx_v_Ay, __pyx_v_Bx, __pyx_v_By, __pyx_v_primes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error)
5891
__Pyx_GOTREF(__pyx_t_3);
5892
__Pyx_DECREF_SET(__pyx_v_v, __pyx_t_3);
5893
__pyx_t_3 = 0;
5894
5895
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":274
5896
* v = compute_ap(Ax, Ay, Bx, By, primes)
5897
*
5898
* mpz_clear(Ax); mpz_clear(Ay); mpz_clear(Bx); mpz_clear(By) # <<<<<<<<<<<<<<
5899
* return v
5900
*
5901
*/
5902
mpz_clear(__pyx_v_Ax);
5903
mpz_clear(__pyx_v_Ay);
5904
mpz_clear(__pyx_v_Bx);
5905
mpz_clear(__pyx_v_By);
5906
5907
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":275
5908
*
5909
* mpz_clear(Ax); mpz_clear(Ay); mpz_clear(Bx); mpz_clear(By)
5910
* return v # <<<<<<<<<<<<<<
5911
*
5912
* from psage.number_fields.sqrt5.prime cimport Prime
5913
*/
5914
__Pyx_XDECREF(__pyx_r);
5915
__Pyx_INCREF(__pyx_v_v);
5916
__pyx_r = __pyx_v_v;
5917
goto __pyx_L0;
5918
5919
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":218
5920
* v[i] = k.cardinality() + 1 - F.change_ring(k).cardinality()
5921
*
5922
* def aplist_short(A, B, primes): # <<<<<<<<<<<<<<
5923
* """
5924
* Return list of `a_P` values that can be quickly computed for the
5925
*/
5926
5927
/* function exit code */
5928
__pyx_L1_error:;
5929
__Pyx_XDECREF(__pyx_t_1);
5930
__Pyx_XDECREF(__pyx_t_2);
5931
__Pyx_XDECREF(__pyx_t_3);
5932
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.aplist_short", __pyx_clineno, __pyx_lineno, __pyx_filename);
5933
__pyx_r = NULL;
5934
__pyx_L0:;
5935
__Pyx_XDECREF(__pyx_v_v);
5936
__Pyx_XDECREF((PyObject *)__pyx_v_z);
5937
__Pyx_XGIVEREF(__pyx_r);
5938
__Pyx_RefNannyFinishContext();
5939
return __pyx_r;
5940
}
5941
5942
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":279
5943
* from psage.number_fields.sqrt5.prime cimport Prime
5944
*
5945
* cdef object compute_split_trace(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, long p, long r): # <<<<<<<<<<<<<<
5946
* """
5947
* Return the trace of Frobenius for the elliptic curve `E` given by
5948
*/
5949
5950
static PyObject *__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_split_trace(__mpz_struct *__pyx_v_Ax, __mpz_struct *__pyx_v_Ay, __mpz_struct *__pyx_v_Bx, __mpz_struct *__pyx_v_By, long __pyx_v_p, long __pyx_v_r) {
5951
long __pyx_v_a;
5952
long __pyx_v_b;
5953
PyObject *__pyx_r = NULL;
5954
__Pyx_RefNannyDeclarations
5955
long __pyx_t_1;
5956
long __pyx_t_2;
5957
int __pyx_t_3;
5958
PyObject *__pyx_t_4 = NULL;
5959
PyObject *__pyx_t_5 = NULL;
5960
PyObject *__pyx_t_6 = NULL;
5961
PyObject *__pyx_t_7 = NULL;
5962
PyObject *__pyx_t_8 = NULL;
5963
PyObject *__pyx_t_9 = NULL;
5964
int __pyx_t_10;
5965
PyObject *__pyx_t_11 = NULL;
5966
__Pyx_RefNannySetupContext("compute_split_trace", 0);
5967
5968
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":299
5969
*
5970
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
5971
* a = mpz_fdiv_ui(Ax, p) + mpz_fdiv_ui(Ay, p)*r # <<<<<<<<<<<<<<
5972
* b = mpz_fdiv_ui(Bx, p) + mpz_fdiv_ui(By, p)*r
5973
*
5974
*/
5975
__pyx_v_a = (mpz_fdiv_ui(__pyx_v_Ax, __pyx_v_p) + (mpz_fdiv_ui(__pyx_v_Ay, __pyx_v_p) * __pyx_v_r));
5976
5977
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":300
5978
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
5979
* a = mpz_fdiv_ui(Ax, p) + mpz_fdiv_ui(Ay, p)*r
5980
* b = mpz_fdiv_ui(Bx, p) + mpz_fdiv_ui(By, p)*r # <<<<<<<<<<<<<<
5981
*
5982
* # 2. Check that the resulting curve is nonsingular
5983
*/
5984
__pyx_v_b = (mpz_fdiv_ui(__pyx_v_Bx, __pyx_v_p) + (mpz_fdiv_ui(__pyx_v_By, __pyx_v_p) * __pyx_v_r));
5985
5986
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":303
5987
*
5988
* # 2. Check that the resulting curve is nonsingular
5989
* if (-64*((a*a) % p) *a - 432*b*b)%p == 0: # <<<<<<<<<<<<<<
5990
* # curve is singular at p -- leave this to some other algorithm
5991
* return None
5992
*/
5993
__pyx_t_1 = (__pyx_v_a * __pyx_v_a);
5994
if (unlikely(__pyx_v_p == 0)) {
5995
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
5996
__PYX_ERR(0, 303, __pyx_L1_error)
5997
}
5998
__pyx_t_2 = (((-64L * __Pyx_mod_long(__pyx_t_1, __pyx_v_p)) * __pyx_v_a) - ((0x1B0 * __pyx_v_b) * __pyx_v_b));
5999
if (unlikely(__pyx_v_p == 0)) {
6000
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
6001
__PYX_ERR(0, 303, __pyx_L1_error)
6002
}
6003
__pyx_t_3 = ((__Pyx_mod_long(__pyx_t_2, __pyx_v_p) == 0) != 0);
6004
if (__pyx_t_3) {
6005
6006
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":305
6007
* if (-64*((a*a) % p) *a - 432*b*b)%p == 0:
6008
* # curve is singular at p -- leave this to some other algorithm
6009
* return None # <<<<<<<<<<<<<<
6010
*
6011
* # 3. Compute the trace using smalljac
6012
*/
6013
__Pyx_XDECREF(__pyx_r);
6014
__Pyx_INCREF(Py_None);
6015
__pyx_r = Py_None;
6016
goto __pyx_L0;
6017
6018
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":303
6019
*
6020
* # 2. Check that the resulting curve is nonsingular
6021
* if (-64*((a*a) % p) *a - 432*b*b)%p == 0: # <<<<<<<<<<<<<<
6022
* # curve is singular at p -- leave this to some other algorithm
6023
* return None
6024
*/
6025
}
6026
6027
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":308
6028
*
6029
* # 3. Compute the trace using smalljac
6030
* return elliptic_curve_ap(a, b, p) # <<<<<<<<<<<<<<
6031
*
6032
* cdef object compute_inert_trace(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, long p):
6033
*/
6034
__Pyx_XDECREF(__pyx_r);
6035
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_elliptic_curve_ap); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 308, __pyx_L1_error)
6036
__Pyx_GOTREF(__pyx_t_5);
6037
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_a); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error)
6038
__Pyx_GOTREF(__pyx_t_6);
6039
__pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_b); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L1_error)
6040
__Pyx_GOTREF(__pyx_t_7);
6041
__pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 308, __pyx_L1_error)
6042
__Pyx_GOTREF(__pyx_t_8);
6043
__pyx_t_9 = NULL;
6044
__pyx_t_10 = 0;
6045
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
6046
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
6047
if (likely(__pyx_t_9)) {
6048
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6049
__Pyx_INCREF(__pyx_t_9);
6050
__Pyx_INCREF(function);
6051
__Pyx_DECREF_SET(__pyx_t_5, function);
6052
__pyx_t_10 = 1;
6053
}
6054
}
6055
#if CYTHON_FAST_PYCALL
6056
if (PyFunction_Check(__pyx_t_5)) {
6057
PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
6058
__pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
6059
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6060
__Pyx_GOTREF(__pyx_t_4);
6061
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6062
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6063
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6064
} else
6065
#endif
6066
#if CYTHON_FAST_PYCCALL
6067
if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
6068
PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_6, __pyx_t_7, __pyx_t_8};
6069
__pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
6070
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6071
__Pyx_GOTREF(__pyx_t_4);
6072
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6073
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6074
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6075
} else
6076
#endif
6077
{
6078
__pyx_t_11 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 308, __pyx_L1_error)
6079
__Pyx_GOTREF(__pyx_t_11);
6080
if (__pyx_t_9) {
6081
__Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
6082
}
6083
__Pyx_GIVEREF(__pyx_t_6);
6084
PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_6);
6085
__Pyx_GIVEREF(__pyx_t_7);
6086
PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_7);
6087
__Pyx_GIVEREF(__pyx_t_8);
6088
PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_8);
6089
__pyx_t_6 = 0;
6090
__pyx_t_7 = 0;
6091
__pyx_t_8 = 0;
6092
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
6093
__Pyx_GOTREF(__pyx_t_4);
6094
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6095
}
6096
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6097
__pyx_r = __pyx_t_4;
6098
__pyx_t_4 = 0;
6099
goto __pyx_L0;
6100
6101
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":279
6102
* from psage.number_fields.sqrt5.prime cimport Prime
6103
*
6104
* cdef object compute_split_trace(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, long p, long r): # <<<<<<<<<<<<<<
6105
* """
6106
* Return the trace of Frobenius for the elliptic curve `E` given by
6107
*/
6108
6109
/* function exit code */
6110
__pyx_L1_error:;
6111
__Pyx_XDECREF(__pyx_t_4);
6112
__Pyx_XDECREF(__pyx_t_5);
6113
__Pyx_XDECREF(__pyx_t_6);
6114
__Pyx_XDECREF(__pyx_t_7);
6115
__Pyx_XDECREF(__pyx_t_8);
6116
__Pyx_XDECREF(__pyx_t_9);
6117
__Pyx_XDECREF(__pyx_t_11);
6118
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.compute_split_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
6119
__pyx_r = 0;
6120
__pyx_L0:;
6121
__Pyx_XGIVEREF(__pyx_r);
6122
__Pyx_RefNannyFinishContext();
6123
return __pyx_r;
6124
}
6125
6126
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":310
6127
* return elliptic_curve_ap(a, b, p)
6128
*
6129
* cdef object compute_inert_trace(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, long p): # <<<<<<<<<<<<<<
6130
* """
6131
* Return the trace of Frobenius for the elliptic curve `E` given by
6132
*/
6133
6134
static PyObject *__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_inert_trace(__mpz_struct *__pyx_v_Ax, __mpz_struct *__pyx_v_Ay, __mpz_struct *__pyx_v_Bx, __mpz_struct *__pyx_v_By, long __pyx_v_p) {
6135
PyObject *__pyx_v_F = NULL;
6136
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R = 0;
6137
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_a4;
6138
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_a6;
6139
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_x;
6140
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_z;
6141
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_w;
6142
Py_ssize_t __pyx_v_i;
6143
long __pyx_v_cnt;
6144
long __pyx_v_ap;
6145
PyObject *__pyx_r = NULL;
6146
__Pyx_RefNannyDeclarations
6147
int __pyx_t_1;
6148
int __pyx_t_2;
6149
PyObject *__pyx_t_3 = NULL;
6150
PyObject *__pyx_t_4 = NULL;
6151
PyObject *__pyx_t_5 = NULL;
6152
PyObject *__pyx_t_6 = NULL;
6153
PyObject *__pyx_t_7 = NULL;
6154
PyObject *__pyx_t_8 = NULL;
6155
PyObject *__pyx_t_9 = NULL;
6156
int __pyx_t_10;
6157
long __pyx_t_11;
6158
Py_ssize_t __pyx_t_12;
6159
__Pyx_RefNannySetupContext("compute_inert_trace", 0);
6160
6161
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":327
6162
* - Python object -- either an int or None
6163
* """
6164
* if p <= 3 or p >= 170: # <<<<<<<<<<<<<<
6165
* # no point using this naive enumeration in these cases
6166
* return None
6167
*/
6168
__pyx_t_2 = ((__pyx_v_p <= 3) != 0);
6169
if (!__pyx_t_2) {
6170
} else {
6171
__pyx_t_1 = __pyx_t_2;
6172
goto __pyx_L4_bool_binop_done;
6173
}
6174
__pyx_t_2 = ((__pyx_v_p >= 0xAA) != 0);
6175
__pyx_t_1 = __pyx_t_2;
6176
__pyx_L4_bool_binop_done:;
6177
if (__pyx_t_1) {
6178
6179
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":329
6180
* if p <= 3 or p >= 170:
6181
* # no point using this naive enumeration in these cases
6182
* return None # <<<<<<<<<<<<<<
6183
*
6184
* from psage.number_fields.sqrt5.misc import F
6185
*/
6186
__Pyx_XDECREF(__pyx_r);
6187
__Pyx_INCREF(Py_None);
6188
__pyx_r = Py_None;
6189
goto __pyx_L0;
6190
6191
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":327
6192
* - Python object -- either an int or None
6193
* """
6194
* if p <= 3 or p >= 170: # <<<<<<<<<<<<<<
6195
* # no point using this naive enumeration in these cases
6196
* return None
6197
*/
6198
}
6199
6200
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":331
6201
* return None
6202
*
6203
* from psage.number_fields.sqrt5.misc import F # <<<<<<<<<<<<<<
6204
*
6205
* cdef ResidueRing_abstract R = ResidueRing(F.ideal([p]), 1)
6206
*/
6207
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
6208
__Pyx_GOTREF(__pyx_t_3);
6209
__Pyx_INCREF(__pyx_n_s_F);
6210
__Pyx_GIVEREF(__pyx_n_s_F);
6211
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_F);
6212
__pyx_t_4 = __Pyx_Import(__pyx_n_s_psage_number_fields_sqrt5_misc, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
6213
__Pyx_GOTREF(__pyx_t_4);
6214
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6215
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_F); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
6216
__Pyx_GOTREF(__pyx_t_3);
6217
__Pyx_INCREF(__pyx_t_3);
6218
__pyx_v_F = __pyx_t_3;
6219
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6220
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6221
6222
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":333
6223
* from psage.number_fields.sqrt5.misc import F
6224
*
6225
* cdef ResidueRing_abstract R = ResidueRing(F.ideal([p]), 1) # <<<<<<<<<<<<<<
6226
* cdef residue_element a4, a6, x, z, w
6227
* cdef Py_ssize_t i
6228
*/
6229
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResidueRing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
6230
__Pyx_GOTREF(__pyx_t_3);
6231
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_ideal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
6232
__Pyx_GOTREF(__pyx_t_6);
6233
__pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
6234
__Pyx_GOTREF(__pyx_t_7);
6235
__pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error)
6236
__Pyx_GOTREF(__pyx_t_8);
6237
__Pyx_GIVEREF(__pyx_t_7);
6238
PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
6239
__pyx_t_7 = 0;
6240
__pyx_t_7 = NULL;
6241
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
6242
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
6243
if (likely(__pyx_t_7)) {
6244
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
6245
__Pyx_INCREF(__pyx_t_7);
6246
__Pyx_INCREF(function);
6247
__Pyx_DECREF_SET(__pyx_t_6, function);
6248
}
6249
}
6250
if (!__pyx_t_7) {
6251
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
6252
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6253
__Pyx_GOTREF(__pyx_t_5);
6254
} else {
6255
#if CYTHON_FAST_PYCALL
6256
if (PyFunction_Check(__pyx_t_6)) {
6257
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_8};
6258
__pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
6259
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6260
__Pyx_GOTREF(__pyx_t_5);
6261
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6262
} else
6263
#endif
6264
#if CYTHON_FAST_PYCCALL
6265
if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
6266
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_8};
6267
__pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
6268
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6269
__Pyx_GOTREF(__pyx_t_5);
6270
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6271
} else
6272
#endif
6273
{
6274
__pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error)
6275
__Pyx_GOTREF(__pyx_t_9);
6276
__Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
6277
__Pyx_GIVEREF(__pyx_t_8);
6278
PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
6279
__pyx_t_8 = 0;
6280
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error)
6281
__Pyx_GOTREF(__pyx_t_5);
6282
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6283
}
6284
}
6285
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6286
__pyx_t_6 = NULL;
6287
__pyx_t_10 = 0;
6288
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6289
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
6290
if (likely(__pyx_t_6)) {
6291
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6292
__Pyx_INCREF(__pyx_t_6);
6293
__Pyx_INCREF(function);
6294
__Pyx_DECREF_SET(__pyx_t_3, function);
6295
__pyx_t_10 = 1;
6296
}
6297
}
6298
#if CYTHON_FAST_PYCALL
6299
if (PyFunction_Check(__pyx_t_3)) {
6300
PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_1};
6301
__pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
6302
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6303
__Pyx_GOTREF(__pyx_t_4);
6304
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6305
} else
6306
#endif
6307
#if CYTHON_FAST_PYCCALL
6308
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
6309
PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_1};
6310
__pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
6311
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6312
__Pyx_GOTREF(__pyx_t_4);
6313
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6314
} else
6315
#endif
6316
{
6317
__pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 333, __pyx_L1_error)
6318
__Pyx_GOTREF(__pyx_t_9);
6319
if (__pyx_t_6) {
6320
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
6321
}
6322
__Pyx_GIVEREF(__pyx_t_5);
6323
PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_5);
6324
__Pyx_INCREF(__pyx_int_1);
6325
__Pyx_GIVEREF(__pyx_int_1);
6326
PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_int_1);
6327
__pyx_t_5 = 0;
6328
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
6329
__Pyx_GOTREF(__pyx_t_4);
6330
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6331
}
6332
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6333
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract))))) __PYX_ERR(0, 333, __pyx_L1_error)
6334
__pyx_v_R = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_t_4);
6335
__pyx_t_4 = 0;
6336
6337
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":337
6338
* cdef Py_ssize_t i
6339
*
6340
* a4[0] = mpz_fdiv_ui(Ax, p); a4[1] = mpz_fdiv_ui(Ay, p) # <<<<<<<<<<<<<<
6341
* a6[0] = mpz_fdiv_ui(Bx, p); a6[1] = mpz_fdiv_ui(By, p)
6342
*
6343
*/
6344
(__pyx_v_a4[0]) = mpz_fdiv_ui(__pyx_v_Ax, __pyx_v_p);
6345
(__pyx_v_a4[1]) = mpz_fdiv_ui(__pyx_v_Ay, __pyx_v_p);
6346
6347
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":338
6348
*
6349
* a4[0] = mpz_fdiv_ui(Ax, p); a4[1] = mpz_fdiv_ui(Ay, p)
6350
* a6[0] = mpz_fdiv_ui(Bx, p); a6[1] = mpz_fdiv_ui(By, p) # <<<<<<<<<<<<<<
6351
*
6352
* # Check if curve is singular, i.e., that this is nonzero: 64*a4^3 + 432*a6^2
6353
*/
6354
(__pyx_v_a6[0]) = mpz_fdiv_ui(__pyx_v_Bx, __pyx_v_p);
6355
(__pyx_v_a6[1]) = mpz_fdiv_ui(__pyx_v_By, __pyx_v_p);
6356
6357
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":341
6358
*
6359
* # Check if curve is singular, i.e., that this is nonzero: 64*a4^3 + 432*a6^2
6360
* R.pow(z, a4, 3) # <<<<<<<<<<<<<<
6361
* R.mul(w, a6, a6)
6362
* R.coerce_from_nf(x, F(64))
6363
*/
6364
__pyx_t_10 = ((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->pow(__pyx_v_R, __pyx_v_z, __pyx_v_a4, 3); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 341, __pyx_L1_error)
6365
6366
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":342
6367
* # Check if curve is singular, i.e., that this is nonzero: 64*a4^3 + 432*a6^2
6368
* R.pow(z, a4, 3)
6369
* R.mul(w, a6, a6) # <<<<<<<<<<<<<<
6370
* R.coerce_from_nf(x, F(64))
6371
* R.mul(z, z, x)
6372
*/
6373
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->mul(__pyx_v_R, __pyx_v_w, __pyx_v_a6, __pyx_v_a6);
6374
6375
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":343
6376
* R.pow(z, a4, 3)
6377
* R.mul(w, a6, a6)
6378
* R.coerce_from_nf(x, F(64)) # <<<<<<<<<<<<<<
6379
* R.mul(z, z, x)
6380
* R.coerce_from_nf(x, F(432))
6381
*/
6382
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_F, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
6383
__Pyx_GOTREF(__pyx_t_4);
6384
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic))))) __PYX_ERR(0, 343, __pyx_L1_error)
6385
__pyx_t_10 = ((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->coerce_from_nf(__pyx_v_R, __pyx_v_x, ((struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *)__pyx_t_4)); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 343, __pyx_L1_error)
6386
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6387
6388
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":344
6389
* R.mul(w, a6, a6)
6390
* R.coerce_from_nf(x, F(64))
6391
* R.mul(z, z, x) # <<<<<<<<<<<<<<
6392
* R.coerce_from_nf(x, F(432))
6393
* R.mul(w, w, x)
6394
*/
6395
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->mul(__pyx_v_R, __pyx_v_z, __pyx_v_z, __pyx_v_x);
6396
6397
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":345
6398
* R.coerce_from_nf(x, F(64))
6399
* R.mul(z, z, x)
6400
* R.coerce_from_nf(x, F(432)) # <<<<<<<<<<<<<<
6401
* R.mul(w, w, x)
6402
* R.add(z, z, w)
6403
*/
6404
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_F, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 345, __pyx_L1_error)
6405
__Pyx_GOTREF(__pyx_t_4);
6406
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic))))) __PYX_ERR(0, 345, __pyx_L1_error)
6407
__pyx_t_10 = ((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->coerce_from_nf(__pyx_v_R, __pyx_v_x, ((struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *)__pyx_t_4)); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 345, __pyx_L1_error)
6408
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6409
6410
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":346
6411
* R.mul(z, z, x)
6412
* R.coerce_from_nf(x, F(432))
6413
* R.mul(w, w, x) # <<<<<<<<<<<<<<
6414
* R.add(z, z, w)
6415
* if R.element_is_0(z):
6416
*/
6417
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->mul(__pyx_v_R, __pyx_v_w, __pyx_v_w, __pyx_v_x);
6418
6419
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":347
6420
* R.coerce_from_nf(x, F(432))
6421
* R.mul(w, w, x)
6422
* R.add(z, z, w) # <<<<<<<<<<<<<<
6423
* if R.element_is_0(z):
6424
* # singular curve
6425
*/
6426
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->add(__pyx_v_R, __pyx_v_z, __pyx_v_z, __pyx_v_w);
6427
6428
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":348
6429
* R.mul(w, w, x)
6430
* R.add(z, z, w)
6431
* if R.element_is_0(z): # <<<<<<<<<<<<<<
6432
* # singular curve
6433
* return None
6434
*/
6435
__pyx_t_1 = (((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->element_is_0(__pyx_v_R, __pyx_v_z) != 0);
6436
if (__pyx_t_1) {
6437
6438
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":350
6439
* if R.element_is_0(z):
6440
* # singular curve
6441
* return None # <<<<<<<<<<<<<<
6442
*
6443
* cdef long cnt = 1 # point at infinity
6444
*/
6445
__Pyx_XDECREF(__pyx_r);
6446
__Pyx_INCREF(Py_None);
6447
__pyx_r = Py_None;
6448
goto __pyx_L0;
6449
6450
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":348
6451
* R.mul(w, w, x)
6452
* R.add(z, z, w)
6453
* if R.element_is_0(z): # <<<<<<<<<<<<<<
6454
* # singular curve
6455
* return None
6456
*/
6457
}
6458
6459
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":352
6460
* return None
6461
*
6462
* cdef long cnt = 1 # point at infinity # <<<<<<<<<<<<<<
6463
* for i in range(R.cardinality()):
6464
* R.unsafe_ith_element(x, i)
6465
*/
6466
__pyx_v_cnt = 1;
6467
6468
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":353
6469
*
6470
* cdef long cnt = 1 # point at infinity
6471
* for i in range(R.cardinality()): # <<<<<<<<<<<<<<
6472
* R.unsafe_ith_element(x, i)
6473
* R.mul(z, x, x) # z = x*x
6474
*/
6475
__pyx_t_11 = ((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->cardinality(__pyx_v_R, 0);
6476
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
6477
__pyx_v_i = __pyx_t_12;
6478
6479
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":354
6480
* cdef long cnt = 1 # point at infinity
6481
* for i in range(R.cardinality()):
6482
* R.unsafe_ith_element(x, i) # <<<<<<<<<<<<<<
6483
* R.mul(z, x, x) # z = x*x
6484
* R.mul(z, z, x) # z = x^3
6485
*/
6486
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->unsafe_ith_element(__pyx_v_R, __pyx_v_x, __pyx_v_i);
6487
6488
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":355
6489
* for i in range(R.cardinality()):
6490
* R.unsafe_ith_element(x, i)
6491
* R.mul(z, x, x) # z = x*x # <<<<<<<<<<<<<<
6492
* R.mul(z, z, x) # z = x^3
6493
* R.mul(w, a4, x) # w = a4*x
6494
*/
6495
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->mul(__pyx_v_R, __pyx_v_z, __pyx_v_x, __pyx_v_x);
6496
6497
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":356
6498
* R.unsafe_ith_element(x, i)
6499
* R.mul(z, x, x) # z = x*x
6500
* R.mul(z, z, x) # z = x^3 # <<<<<<<<<<<<<<
6501
* R.mul(w, a4, x) # w = a4*x
6502
* R.add(z, z, w) # z = z + w = x^3 + a4*x
6503
*/
6504
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->mul(__pyx_v_R, __pyx_v_z, __pyx_v_z, __pyx_v_x);
6505
6506
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":357
6507
* R.mul(z, x, x) # z = x*x
6508
* R.mul(z, z, x) # z = x^3
6509
* R.mul(w, a4, x) # w = a4*x # <<<<<<<<<<<<<<
6510
* R.add(z, z, w) # z = z + w = x^3 + a4*x
6511
* R.add(z, z, a6) # z = x^3 + a4*x + a6
6512
*/
6513
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->mul(__pyx_v_R, __pyx_v_w, __pyx_v_a4, __pyx_v_x);
6514
6515
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":358
6516
* R.mul(z, z, x) # z = x^3
6517
* R.mul(w, a4, x) # w = a4*x
6518
* R.add(z, z, w) # z = z + w = x^3 + a4*x # <<<<<<<<<<<<<<
6519
* R.add(z, z, a6) # z = x^3 + a4*x + a6
6520
* if R.element_is_0(z):
6521
*/
6522
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->add(__pyx_v_R, __pyx_v_z, __pyx_v_z, __pyx_v_w);
6523
6524
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":359
6525
* R.mul(w, a4, x) # w = a4*x
6526
* R.add(z, z, w) # z = z + w = x^3 + a4*x
6527
* R.add(z, z, a6) # z = x^3 + a4*x + a6 # <<<<<<<<<<<<<<
6528
* if R.element_is_0(z):
6529
* cnt += 1
6530
*/
6531
((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->add(__pyx_v_R, __pyx_v_z, __pyx_v_z, __pyx_v_a6);
6532
6533
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":360
6534
* R.add(z, z, w) # z = z + w = x^3 + a4*x
6535
* R.add(z, z, a6) # z = x^3 + a4*x + a6
6536
* if R.element_is_0(z): # <<<<<<<<<<<<<<
6537
* cnt += 1
6538
* elif R.is_square(z):
6539
*/
6540
__pyx_t_1 = (((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->element_is_0(__pyx_v_R, __pyx_v_z) != 0);
6541
if (__pyx_t_1) {
6542
6543
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":361
6544
* R.add(z, z, a6) # z = x^3 + a4*x + a6
6545
* if R.element_is_0(z):
6546
* cnt += 1 # <<<<<<<<<<<<<<
6547
* elif R.is_square(z):
6548
* cnt += 2
6549
*/
6550
__pyx_v_cnt = (__pyx_v_cnt + 1);
6551
6552
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":360
6553
* R.add(z, z, w) # z = z + w = x^3 + a4*x
6554
* R.add(z, z, a6) # z = x^3 + a4*x + a6
6555
* if R.element_is_0(z): # <<<<<<<<<<<<<<
6556
* cnt += 1
6557
* elif R.is_square(z):
6558
*/
6559
goto __pyx_L9;
6560
}
6561
6562
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":362
6563
* if R.element_is_0(z):
6564
* cnt += 1
6565
* elif R.is_square(z): # <<<<<<<<<<<<<<
6566
* cnt += 2
6567
* ap = R.cardinality() + 1 - cnt
6568
*/
6569
__pyx_t_1 = ((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->is_square(__pyx_v_R, __pyx_v_z); if (unlikely(__pyx_t_1 == -2)) __PYX_ERR(0, 362, __pyx_L1_error)
6570
__pyx_t_2 = (__pyx_t_1 != 0);
6571
if (__pyx_t_2) {
6572
6573
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":363
6574
* cnt += 1
6575
* elif R.is_square(z):
6576
* cnt += 2 # <<<<<<<<<<<<<<
6577
* ap = R.cardinality() + 1 - cnt
6578
* return ap
6579
*/
6580
__pyx_v_cnt = (__pyx_v_cnt + 2);
6581
6582
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":362
6583
* if R.element_is_0(z):
6584
* cnt += 1
6585
* elif R.is_square(z): # <<<<<<<<<<<<<<
6586
* cnt += 2
6587
* ap = R.cardinality() + 1 - cnt
6588
*/
6589
}
6590
__pyx_L9:;
6591
}
6592
6593
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":364
6594
* elif R.is_square(z):
6595
* cnt += 2
6596
* ap = R.cardinality() + 1 - cnt # <<<<<<<<<<<<<<
6597
* return ap
6598
*
6599
*/
6600
__pyx_v_ap = ((((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_v_R->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->cardinality(__pyx_v_R, 0) + 1) - __pyx_v_cnt);
6601
6602
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":365
6603
* cnt += 2
6604
* ap = R.cardinality() + 1 - cnt
6605
* return ap # <<<<<<<<<<<<<<
6606
*
6607
*
6608
*/
6609
__Pyx_XDECREF(__pyx_r);
6610
__pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_ap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error)
6611
__Pyx_GOTREF(__pyx_t_4);
6612
__pyx_r = __pyx_t_4;
6613
__pyx_t_4 = 0;
6614
goto __pyx_L0;
6615
6616
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":310
6617
* return elliptic_curve_ap(a, b, p)
6618
*
6619
* cdef object compute_inert_trace(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, long p): # <<<<<<<<<<<<<<
6620
* """
6621
* Return the trace of Frobenius for the elliptic curve `E` given by
6622
*/
6623
6624
/* function exit code */
6625
__pyx_L1_error:;
6626
__Pyx_XDECREF(__pyx_t_3);
6627
__Pyx_XDECREF(__pyx_t_4);
6628
__Pyx_XDECREF(__pyx_t_5);
6629
__Pyx_XDECREF(__pyx_t_6);
6630
__Pyx_XDECREF(__pyx_t_7);
6631
__Pyx_XDECREF(__pyx_t_8);
6632
__Pyx_XDECREF(__pyx_t_9);
6633
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.compute_inert_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
6634
__pyx_r = 0;
6635
__pyx_L0:;
6636
__Pyx_XDECREF(__pyx_v_F);
6637
__Pyx_XDECREF((PyObject *)__pyx_v_R);
6638
__Pyx_XGIVEREF(__pyx_r);
6639
__Pyx_RefNannyFinishContext();
6640
return __pyx_r;
6641
}
6642
6643
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":368
6644
*
6645
*
6646
* cdef compute_ap(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, primes): # <<<<<<<<<<<<<<
6647
* """
6648
* Return list of `a_P` values that can be quickly computed for the
6649
*/
6650
6651
static PyObject *__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_ap(__mpz_struct *__pyx_v_Ax, __mpz_struct *__pyx_v_Ay, __mpz_struct *__pyx_v_Bx, __mpz_struct *__pyx_v_By, PyObject *__pyx_v_primes) {
6652
struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime *__pyx_v_P = 0;
6653
PyObject *__pyx_v_v = 0;
6654
PyObject *__pyx_v_ap = NULL;
6655
PyObject *__pyx_r = NULL;
6656
__Pyx_RefNannyDeclarations
6657
PyObject *__pyx_t_1 = NULL;
6658
Py_ssize_t __pyx_t_2;
6659
PyObject *(*__pyx_t_3)(PyObject *);
6660
PyObject *__pyx_t_4 = NULL;
6661
int __pyx_t_5;
6662
int __pyx_t_6;
6663
__Pyx_RefNannySetupContext("compute_ap", 0);
6664
6665
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":383
6666
* """
6667
* cdef Prime P
6668
* cdef list v = [] # <<<<<<<<<<<<<<
6669
* for P in primes:
6670
* if P.is_split():
6671
*/
6672
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
6673
__Pyx_GOTREF(__pyx_t_1);
6674
__pyx_v_v = ((PyObject*)__pyx_t_1);
6675
__pyx_t_1 = 0;
6676
6677
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":384
6678
* cdef Prime P
6679
* cdef list v = []
6680
* for P in primes: # <<<<<<<<<<<<<<
6681
* if P.is_split():
6682
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6683
*/
6684
if (likely(PyList_CheckExact(__pyx_v_primes)) || PyTuple_CheckExact(__pyx_v_primes)) {
6685
__pyx_t_1 = __pyx_v_primes; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6686
__pyx_t_3 = NULL;
6687
} else {
6688
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_primes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
6689
__Pyx_GOTREF(__pyx_t_1);
6690
__pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
6691
}
6692
for (;;) {
6693
if (likely(!__pyx_t_3)) {
6694
if (likely(PyList_CheckExact(__pyx_t_1))) {
6695
if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
6696
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6697
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 384, __pyx_L1_error)
6698
#else
6699
__pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
6700
__Pyx_GOTREF(__pyx_t_4);
6701
#endif
6702
} else {
6703
if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6704
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6705
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 384, __pyx_L1_error)
6706
#else
6707
__pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
6708
__Pyx_GOTREF(__pyx_t_4);
6709
#endif
6710
}
6711
} else {
6712
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
6713
if (unlikely(!__pyx_t_4)) {
6714
PyObject* exc_type = PyErr_Occurred();
6715
if (exc_type) {
6716
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6717
else __PYX_ERR(0, 384, __pyx_L1_error)
6718
}
6719
break;
6720
}
6721
__Pyx_GOTREF(__pyx_t_4);
6722
}
6723
if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5psage_13number_fields_5sqrt5_5prime_Prime))))) __PYX_ERR(0, 384, __pyx_L1_error)
6724
__Pyx_XDECREF_SET(__pyx_v_P, ((struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime *)__pyx_t_4));
6725
__pyx_t_4 = 0;
6726
6727
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":385
6728
* cdef list v = []
6729
* for P in primes:
6730
* if P.is_split(): # <<<<<<<<<<<<<<
6731
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6732
* elif P.is_ramified():
6733
*/
6734
__pyx_t_5 = (((struct __pyx_vtabstruct_5psage_13number_fields_5sqrt5_5prime_Prime *)__pyx_v_P->__pyx_vtab)->is_split(__pyx_v_P, 0) != 0);
6735
if (__pyx_t_5) {
6736
6737
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":386
6738
* for P in primes:
6739
* if P.is_split():
6740
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r) # <<<<<<<<<<<<<<
6741
* elif P.is_ramified():
6742
* ap = None
6743
*/
6744
__pyx_t_4 = __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_split_trace(__pyx_v_Ax, __pyx_v_Ay, __pyx_v_Bx, __pyx_v_By, __pyx_v_P->p, __pyx_v_P->r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 386, __pyx_L1_error)
6745
__Pyx_GOTREF(__pyx_t_4);
6746
__Pyx_XDECREF_SET(__pyx_v_ap, __pyx_t_4);
6747
__pyx_t_4 = 0;
6748
6749
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":385
6750
* cdef list v = []
6751
* for P in primes:
6752
* if P.is_split(): # <<<<<<<<<<<<<<
6753
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6754
* elif P.is_ramified():
6755
*/
6756
goto __pyx_L5;
6757
}
6758
6759
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":387
6760
* if P.is_split():
6761
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6762
* elif P.is_ramified(): # <<<<<<<<<<<<<<
6763
* ap = None
6764
* else: # inert
6765
*/
6766
__pyx_t_5 = (((struct __pyx_vtabstruct_5psage_13number_fields_5sqrt5_5prime_Prime *)__pyx_v_P->__pyx_vtab)->is_ramified(__pyx_v_P, 0) != 0);
6767
if (__pyx_t_5) {
6768
6769
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":388
6770
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6771
* elif P.is_ramified():
6772
* ap = None # <<<<<<<<<<<<<<
6773
* else: # inert
6774
* ap = compute_inert_trace(Ax, Ay, Bx, By, P.p)
6775
*/
6776
__Pyx_INCREF(Py_None);
6777
__Pyx_XDECREF_SET(__pyx_v_ap, Py_None);
6778
6779
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":387
6780
* if P.is_split():
6781
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6782
* elif P.is_ramified(): # <<<<<<<<<<<<<<
6783
* ap = None
6784
* else: # inert
6785
*/
6786
goto __pyx_L5;
6787
}
6788
6789
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":390
6790
* ap = None
6791
* else: # inert
6792
* ap = compute_inert_trace(Ax, Ay, Bx, By, P.p) # <<<<<<<<<<<<<<
6793
* v.append(ap)
6794
* return v
6795
*/
6796
/*else*/ {
6797
__pyx_t_4 = __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_compute_inert_trace(__pyx_v_Ax, __pyx_v_Ay, __pyx_v_Bx, __pyx_v_By, __pyx_v_P->p); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error)
6798
__Pyx_GOTREF(__pyx_t_4);
6799
__Pyx_XDECREF_SET(__pyx_v_ap, __pyx_t_4);
6800
__pyx_t_4 = 0;
6801
}
6802
__pyx_L5:;
6803
6804
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":391
6805
* else: # inert
6806
* ap = compute_inert_trace(Ax, Ay, Bx, By, P.p)
6807
* v.append(ap) # <<<<<<<<<<<<<<
6808
* return v
6809
*
6810
*/
6811
__pyx_t_6 = __Pyx_PyList_Append(__pyx_v_v, __pyx_v_ap); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 391, __pyx_L1_error)
6812
6813
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":384
6814
* cdef Prime P
6815
* cdef list v = []
6816
* for P in primes: # <<<<<<<<<<<<<<
6817
* if P.is_split():
6818
* ap = compute_split_trace(Ax, Ay, Bx, By, P.p, P.r)
6819
*/
6820
}
6821
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6822
6823
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":392
6824
* ap = compute_inert_trace(Ax, Ay, Bx, By, P.p)
6825
* v.append(ap)
6826
* return v # <<<<<<<<<<<<<<
6827
*
6828
*/
6829
__Pyx_XDECREF(__pyx_r);
6830
__Pyx_INCREF(__pyx_v_v);
6831
__pyx_r = __pyx_v_v;
6832
goto __pyx_L0;
6833
6834
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":368
6835
*
6836
*
6837
* cdef compute_ap(mpz_t Ax, mpz_t Ay, mpz_t Bx, mpz_t By, primes): # <<<<<<<<<<<<<<
6838
* """
6839
* Return list of `a_P` values that can be quickly computed for the
6840
*/
6841
6842
/* function exit code */
6843
__pyx_L1_error:;
6844
__Pyx_XDECREF(__pyx_t_1);
6845
__Pyx_XDECREF(__pyx_t_4);
6846
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.compute_ap", __pyx_clineno, __pyx_lineno, __pyx_filename);
6847
__pyx_r = 0;
6848
__pyx_L0:;
6849
__Pyx_XDECREF((PyObject *)__pyx_v_P);
6850
__Pyx_XDECREF(__pyx_v_v);
6851
__Pyx_XDECREF(__pyx_v_ap);
6852
__Pyx_XGIVEREF(__pyx_r);
6853
__Pyx_RefNannyFinishContext();
6854
return __pyx_r;
6855
}
6856
6857
/* "sage/structure/element.pxd":7
6858
*
6859
*
6860
* cpdef inline parent(x): # <<<<<<<<<<<<<<
6861
* """
6862
* Return the parent of the element ``x``.
6863
*/
6864
6865
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
6866
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
6867
PyObject *__pyx_v_p = NULL;
6868
PyObject *__pyx_r = NULL;
6869
__Pyx_RefNannyDeclarations
6870
int __pyx_t_1;
6871
int __pyx_t_2;
6872
PyObject *__pyx_t_3 = NULL;
6873
PyObject *__pyx_t_4 = NULL;
6874
PyObject *__pyx_t_5 = NULL;
6875
PyObject *__pyx_t_6 = NULL;
6876
PyObject *__pyx_t_7 = NULL;
6877
PyObject *__pyx_t_8 = NULL;
6878
int __pyx_t_9;
6879
__Pyx_RefNannySetupContext("parent", 0);
6880
6881
/* "sage/structure/element.pxd":63
6882
* <... 'list'>
6883
* """
6884
* if isinstance(x, Element): # <<<<<<<<<<<<<<
6885
* return (<Element>x)._parent
6886
* # Fast check for "number" types, including int and float
6887
*/
6888
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, __pyx_ptype_4sage_9structure_7element_Element);
6889
__pyx_t_2 = (__pyx_t_1 != 0);
6890
if (__pyx_t_2) {
6891
6892
/* "sage/structure/element.pxd":64
6893
* """
6894
* if isinstance(x, Element):
6895
* return (<Element>x)._parent # <<<<<<<<<<<<<<
6896
* # Fast check for "number" types, including int and float
6897
* if PyNumber_Check(x):
6898
*/
6899
__Pyx_XDECREF(__pyx_r);
6900
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent));
6901
__pyx_r = ((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent);
6902
goto __pyx_L0;
6903
6904
/* "sage/structure/element.pxd":63
6905
* <... 'list'>
6906
* """
6907
* if isinstance(x, Element): # <<<<<<<<<<<<<<
6908
* return (<Element>x)._parent
6909
* # Fast check for "number" types, including int and float
6910
*/
6911
}
6912
6913
/* "sage/structure/element.pxd":66
6914
* return (<Element>x)._parent
6915
* # Fast check for "number" types, including int and float
6916
* if PyNumber_Check(x): # <<<<<<<<<<<<<<
6917
* return type(x)
6918
* try:
6919
*/
6920
__pyx_t_2 = (PyNumber_Check(__pyx_v_x) != 0);
6921
if (__pyx_t_2) {
6922
6923
/* "sage/structure/element.pxd":67
6924
* # Fast check for "number" types, including int and float
6925
* if PyNumber_Check(x):
6926
* return type(x) # <<<<<<<<<<<<<<
6927
* try:
6928
* p = x.parent
6929
*/
6930
__Pyx_XDECREF(__pyx_r);
6931
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
6932
__pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
6933
goto __pyx_L0;
6934
6935
/* "sage/structure/element.pxd":66
6936
* return (<Element>x)._parent
6937
* # Fast check for "number" types, including int and float
6938
* if PyNumber_Check(x): # <<<<<<<<<<<<<<
6939
* return type(x)
6940
* try:
6941
*/
6942
}
6943
6944
/* "sage/structure/element.pxd":68
6945
* if PyNumber_Check(x):
6946
* return type(x)
6947
* try: # <<<<<<<<<<<<<<
6948
* p = x.parent
6949
* except AttributeError:
6950
*/
6951
{
6952
__Pyx_PyThreadState_declare
6953
__Pyx_PyThreadState_assign
6954
__Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
6955
__Pyx_XGOTREF(__pyx_t_3);
6956
__Pyx_XGOTREF(__pyx_t_4);
6957
__Pyx_XGOTREF(__pyx_t_5);
6958
/*try:*/ {
6959
6960
/* "sage/structure/element.pxd":69
6961
* return type(x)
6962
* try:
6963
* p = x.parent # <<<<<<<<<<<<<<
6964
* except AttributeError:
6965
* return type(x)
6966
*/
6967
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_parent); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 69, __pyx_L5_error)
6968
__Pyx_GOTREF(__pyx_t_6);
6969
__pyx_v_p = __pyx_t_6;
6970
__pyx_t_6 = 0;
6971
6972
/* "sage/structure/element.pxd":68
6973
* if PyNumber_Check(x):
6974
* return type(x)
6975
* try: # <<<<<<<<<<<<<<
6976
* p = x.parent
6977
* except AttributeError:
6978
*/
6979
}
6980
6981
/* "sage/structure/element.pxd":73
6982
* return type(x)
6983
* else:
6984
* return p() # <<<<<<<<<<<<<<
6985
*
6986
*
6987
*/
6988
/*else:*/ {
6989
__Pyx_XDECREF(__pyx_r);
6990
__Pyx_INCREF(__pyx_v_p);
6991
__pyx_t_7 = __pyx_v_p; __pyx_t_8 = NULL;
6992
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
6993
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
6994
if (likely(__pyx_t_8)) {
6995
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6996
__Pyx_INCREF(__pyx_t_8);
6997
__Pyx_INCREF(function);
6998
__Pyx_DECREF_SET(__pyx_t_7, function);
6999
}
7000
}
7001
if (__pyx_t_8) {
7002
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 73, __pyx_L7_except_error)
7003
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7004
} else {
7005
__pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 73, __pyx_L7_except_error)
7006
}
7007
__Pyx_GOTREF(__pyx_t_6);
7008
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7009
__pyx_r = __pyx_t_6;
7010
__pyx_t_6 = 0;
7011
goto __pyx_L8_except_return;
7012
}
7013
__pyx_L5_error:;
7014
__Pyx_PyThreadState_assign
7015
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7016
7017
/* "sage/structure/element.pxd":70
7018
* try:
7019
* p = x.parent
7020
* except AttributeError: # <<<<<<<<<<<<<<
7021
* return type(x)
7022
* else:
7023
*/
7024
__pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
7025
if (__pyx_t_9) {
7026
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
7027
if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 70, __pyx_L7_except_error)
7028
__Pyx_GOTREF(__pyx_t_6);
7029
__Pyx_GOTREF(__pyx_t_7);
7030
__Pyx_GOTREF(__pyx_t_8);
7031
7032
/* "sage/structure/element.pxd":71
7033
* p = x.parent
7034
* except AttributeError:
7035
* return type(x) # <<<<<<<<<<<<<<
7036
* else:
7037
* return p()
7038
*/
7039
__Pyx_XDECREF(__pyx_r);
7040
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
7041
__pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
7042
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7043
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7044
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7045
goto __pyx_L8_except_return;
7046
}
7047
goto __pyx_L7_except_error;
7048
__pyx_L7_except_error:;
7049
7050
/* "sage/structure/element.pxd":68
7051
* if PyNumber_Check(x):
7052
* return type(x)
7053
* try: # <<<<<<<<<<<<<<
7054
* p = x.parent
7055
* except AttributeError:
7056
*/
7057
__Pyx_PyThreadState_assign
7058
__Pyx_XGIVEREF(__pyx_t_3);
7059
__Pyx_XGIVEREF(__pyx_t_4);
7060
__Pyx_XGIVEREF(__pyx_t_5);
7061
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
7062
goto __pyx_L1_error;
7063
__pyx_L8_except_return:;
7064
__Pyx_PyThreadState_assign
7065
__Pyx_XGIVEREF(__pyx_t_3);
7066
__Pyx_XGIVEREF(__pyx_t_4);
7067
__Pyx_XGIVEREF(__pyx_t_5);
7068
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
7069
goto __pyx_L0;
7070
}
7071
7072
/* "sage/structure/element.pxd":7
7073
*
7074
*
7075
* cpdef inline parent(x): # <<<<<<<<<<<<<<
7076
* """
7077
* Return the parent of the element ``x``.
7078
*/
7079
7080
/* function exit code */
7081
__pyx_L1_error:;
7082
__Pyx_XDECREF(__pyx_t_6);
7083
__Pyx_XDECREF(__pyx_t_7);
7084
__Pyx_XDECREF(__pyx_t_8);
7085
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
7086
__pyx_r = 0;
7087
__pyx_L0:;
7088
__Pyx_XDECREF(__pyx_v_p);
7089
__Pyx_XGIVEREF(__pyx_r);
7090
__Pyx_RefNannyFinishContext();
7091
return __pyx_r;
7092
}
7093
7094
/* Python wrapper */
7095
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
7096
static char __pyx_doc_4sage_9structure_7element_parent[] = "File: (starting at line 7)\n\n Return the parent of the element ``x``.\n\n Usually, this means the mathematical object of which ``x`` is an\n element.\n\n INPUT:\n\n - ``x`` -- an element\n\n OUTPUT:\n\n - If ``x`` is a Sage :class:`Element`, return ``x.parent()``.\n\n - If ``x`` has a ``parent`` method and ``x`` does not have an\n ``__int__`` or ``__float__`` method, return ``x.parent()``.\n\n - Otherwise, return ``type(x)``.\n\n .. SEEALSO::\n\n `Parents, Conversion and Coercion <http://doc.sagemath.org/html/en/tutorial/tour_coercion.html>`_\n Section in the Sage Tutorial\n\n EXAMPLES::\n\n sage: a = 42\n sage: parent(a)\n Integer Ring\n sage: b = 42/1\n sage: parent(b)\n Rational Field\n sage: c = 42.0\n sage: parent(c)\n Real Field with 53 bits of precision\n\n Some more complicated examples::\n\n sage: x = Partition([3,2,1,1,1])\n sage: parent(x)\n Partitions\n sage: v = vector(RDF, [1,2,3])\n sage: parent(v)\n Vector space of dimension 3 over Real Double Field\n\n The following are not considered to be elements, so the type is\n returned::\n\n sage: d = int(42) # Python int\n sage: parent(d)\n <type 'int'>\n sage: L = list(range(10))\n sage: parent(L)\n <... 'list'>\n ";
7097
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x) {
7098
PyObject *__pyx_r = 0;
7099
__Pyx_RefNannyDeclarations
7100
__Pyx_RefNannySetupContext("parent (wrapper)", 0);
7101
__pyx_r = __pyx_pf_4sage_9structure_7element_parent(__pyx_self, ((PyObject *)__pyx_v_x));
7102
7103
/* function exit code */
7104
__Pyx_RefNannyFinishContext();
7105
return __pyx_r;
7106
}
7107
7108
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
7109
PyObject *__pyx_r = NULL;
7110
__Pyx_RefNannyDeclarations
7111
PyObject *__pyx_t_1 = NULL;
7112
__Pyx_RefNannySetupContext("parent", 0);
7113
__Pyx_XDECREF(__pyx_r);
7114
__pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error)
7115
__Pyx_GOTREF(__pyx_t_1);
7116
__pyx_r = __pyx_t_1;
7117
__pyx_t_1 = 0;
7118
goto __pyx_L0;
7119
7120
/* function exit code */
7121
__pyx_L1_error:;
7122
__Pyx_XDECREF(__pyx_t_1);
7123
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
7124
__pyx_r = NULL;
7125
__pyx_L0:;
7126
__Pyx_XGIVEREF(__pyx_r);
7127
__Pyx_RefNannyFinishContext();
7128
return __pyx_r;
7129
}
7130
7131
/* "sage/structure/element.pxd":76
7132
*
7133
*
7134
* cdef inline int classify_elements(left, right): # <<<<<<<<<<<<<<
7135
* """
7136
* Given two objects, at least one which is an :class:`Element`,
7137
*/
7138
7139
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
7140
int __pyx_r;
7141
__Pyx_RefNannyDeclarations
7142
int __pyx_t_1;
7143
int __pyx_t_2;
7144
__Pyx_RefNannySetupContext("classify_elements", 0);
7145
7146
/* "sage/structure/element.pxd":99
7147
* - 0o37: both are Element, same type, same parent
7148
* """
7149
* if type(left) is type(right): # <<<<<<<<<<<<<<
7150
* # We know at least one of the arguments is an Element. So if
7151
* # their types are *equal* (fast to check) then they are both
7152
*/
7153
__pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_left)) == ((PyObject *)Py_TYPE(__pyx_v_right)));
7154
__pyx_t_2 = (__pyx_t_1 != 0);
7155
if (__pyx_t_2) {
7156
7157
/* "sage/structure/element.pxd":103
7158
* # their types are *equal* (fast to check) then they are both
7159
* # Elements.
7160
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
7161
* return 0o37
7162
* else:
7163
*/
7164
__pyx_t_2 = (((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_left)->_parent == ((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_right)->_parent);
7165
__pyx_t_1 = (__pyx_t_2 != 0);
7166
if (__pyx_t_1) {
7167
7168
/* "sage/structure/element.pxd":104
7169
* # Elements.
7170
* if (<Element>left)._parent is (<Element>right)._parent:
7171
* return 0o37 # <<<<<<<<<<<<<<
7172
* else:
7173
* return 0o17
7174
*/
7175
__pyx_r = 037;
7176
goto __pyx_L0;
7177
7178
/* "sage/structure/element.pxd":103
7179
* # their types are *equal* (fast to check) then they are both
7180
* # Elements.
7181
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
7182
* return 0o37
7183
* else:
7184
*/
7185
}
7186
7187
/* "sage/structure/element.pxd":106
7188
* return 0o37
7189
* else:
7190
* return 0o17 # <<<<<<<<<<<<<<
7191
* if not isinstance(right, Element):
7192
* return 0o01
7193
*/
7194
/*else*/ {
7195
__pyx_r = 017;
7196
goto __pyx_L0;
7197
}
7198
7199
/* "sage/structure/element.pxd":99
7200
* - 0o37: both are Element, same type, same parent
7201
* """
7202
* if type(left) is type(right): # <<<<<<<<<<<<<<
7203
* # We know at least one of the arguments is an Element. So if
7204
* # their types are *equal* (fast to check) then they are both
7205
*/
7206
}
7207
7208
/* "sage/structure/element.pxd":107
7209
* else:
7210
* return 0o17
7211
* if not isinstance(right, Element): # <<<<<<<<<<<<<<
7212
* return 0o01
7213
* if not isinstance(left, Element):
7214
*/
7215
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_right, __pyx_ptype_4sage_9structure_7element_Element);
7216
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
7217
if (__pyx_t_2) {
7218
7219
/* "sage/structure/element.pxd":108
7220
* return 0o17
7221
* if not isinstance(right, Element):
7222
* return 0o01 # <<<<<<<<<<<<<<
7223
* if not isinstance(left, Element):
7224
* return 0o02
7225
*/
7226
__pyx_r = 001;
7227
goto __pyx_L0;
7228
7229
/* "sage/structure/element.pxd":107
7230
* else:
7231
* return 0o17
7232
* if not isinstance(right, Element): # <<<<<<<<<<<<<<
7233
* return 0o01
7234
* if not isinstance(left, Element):
7235
*/
7236
}
7237
7238
/* "sage/structure/element.pxd":109
7239
* if not isinstance(right, Element):
7240
* return 0o01
7241
* if not isinstance(left, Element): # <<<<<<<<<<<<<<
7242
* return 0o02
7243
* if (<Element>left)._parent is (<Element>right)._parent:
7244
*/
7245
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_left, __pyx_ptype_4sage_9structure_7element_Element);
7246
__pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
7247
if (__pyx_t_1) {
7248
7249
/* "sage/structure/element.pxd":110
7250
* return 0o01
7251
* if not isinstance(left, Element):
7252
* return 0o02 # <<<<<<<<<<<<<<
7253
* if (<Element>left)._parent is (<Element>right)._parent:
7254
* return 0o27
7255
*/
7256
__pyx_r = 002;
7257
goto __pyx_L0;
7258
7259
/* "sage/structure/element.pxd":109
7260
* if not isinstance(right, Element):
7261
* return 0o01
7262
* if not isinstance(left, Element): # <<<<<<<<<<<<<<
7263
* return 0o02
7264
* if (<Element>left)._parent is (<Element>right)._parent:
7265
*/
7266
}
7267
7268
/* "sage/structure/element.pxd":111
7269
* if not isinstance(left, Element):
7270
* return 0o02
7271
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
7272
* return 0o27
7273
* else:
7274
*/
7275
__pyx_t_1 = (((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_left)->_parent == ((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_right)->_parent);
7276
__pyx_t_2 = (__pyx_t_1 != 0);
7277
if (__pyx_t_2) {
7278
7279
/* "sage/structure/element.pxd":112
7280
* return 0o02
7281
* if (<Element>left)._parent is (<Element>right)._parent:
7282
* return 0o27 # <<<<<<<<<<<<<<
7283
* else:
7284
* return 0o07
7285
*/
7286
__pyx_r = 027;
7287
goto __pyx_L0;
7288
7289
/* "sage/structure/element.pxd":111
7290
* if not isinstance(left, Element):
7291
* return 0o02
7292
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
7293
* return 0o27
7294
* else:
7295
*/
7296
}
7297
7298
/* "sage/structure/element.pxd":114
7299
* return 0o27
7300
* else:
7301
* return 0o07 # <<<<<<<<<<<<<<
7302
*
7303
* # Functions to help understand the result of classify_elements()
7304
*/
7305
/*else*/ {
7306
__pyx_r = 007;
7307
goto __pyx_L0;
7308
}
7309
7310
/* "sage/structure/element.pxd":76
7311
*
7312
*
7313
* cdef inline int classify_elements(left, right): # <<<<<<<<<<<<<<
7314
* """
7315
* Given two objects, at least one which is an :class:`Element`,
7316
*/
7317
7318
/* function exit code */
7319
__pyx_L0:;
7320
__Pyx_RefNannyFinishContext();
7321
return __pyx_r;
7322
}
7323
7324
/* "sage/structure/element.pxd":117
7325
*
7326
* # Functions to help understand the result of classify_elements()
7327
* cdef inline bint BOTH_ARE_ELEMENT(int cl): # <<<<<<<<<<<<<<
7328
* return cl & 0o04
7329
* cdef inline bint HAVE_SAME_PARENT(int cl):
7330
*/
7331
7332
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_BOTH_ARE_ELEMENT(int __pyx_v_cl) {
7333
int __pyx_r;
7334
__Pyx_RefNannyDeclarations
7335
__Pyx_RefNannySetupContext("BOTH_ARE_ELEMENT", 0);
7336
7337
/* "sage/structure/element.pxd":118
7338
* # Functions to help understand the result of classify_elements()
7339
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
7340
* return cl & 0o04 # <<<<<<<<<<<<<<
7341
* cdef inline bint HAVE_SAME_PARENT(int cl):
7342
* return cl & 0o20
7343
*/
7344
__pyx_r = (__pyx_v_cl & 004);
7345
goto __pyx_L0;
7346
7347
/* "sage/structure/element.pxd":117
7348
*
7349
* # Functions to help understand the result of classify_elements()
7350
* cdef inline bint BOTH_ARE_ELEMENT(int cl): # <<<<<<<<<<<<<<
7351
* return cl & 0o04
7352
* cdef inline bint HAVE_SAME_PARENT(int cl):
7353
*/
7354
7355
/* function exit code */
7356
__pyx_L0:;
7357
__Pyx_RefNannyFinishContext();
7358
return __pyx_r;
7359
}
7360
7361
/* "sage/structure/element.pxd":119
7362
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
7363
* return cl & 0o04
7364
* cdef inline bint HAVE_SAME_PARENT(int cl): # <<<<<<<<<<<<<<
7365
* return cl & 0o20
7366
*
7367
*/
7368
7369
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int __pyx_v_cl) {
7370
int __pyx_r;
7371
__Pyx_RefNannyDeclarations
7372
__Pyx_RefNannySetupContext("HAVE_SAME_PARENT", 0);
7373
7374
/* "sage/structure/element.pxd":120
7375
* return cl & 0o04
7376
* cdef inline bint HAVE_SAME_PARENT(int cl):
7377
* return cl & 0o20 # <<<<<<<<<<<<<<
7378
*
7379
*
7380
*/
7381
__pyx_r = (__pyx_v_cl & 020);
7382
goto __pyx_L0;
7383
7384
/* "sage/structure/element.pxd":119
7385
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
7386
* return cl & 0o04
7387
* cdef inline bint HAVE_SAME_PARENT(int cl): # <<<<<<<<<<<<<<
7388
* return cl & 0o20
7389
*
7390
*/
7391
7392
/* function exit code */
7393
__pyx_L0:;
7394
__Pyx_RefNannyFinishContext();
7395
return __pyx_r;
7396
}
7397
7398
/* "sage/structure/element.pxd":123
7399
*
7400
*
7401
* cpdef inline bint have_same_parent(left, right): # <<<<<<<<<<<<<<
7402
* """
7403
* Return ``True`` if and only if ``left`` and ``right`` have the
7404
*/
7405
7406
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7407
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *__pyx_v_left, PyObject *__pyx_v_right, CYTHON_UNUSED int __pyx_skip_dispatch) {
7408
int __pyx_r;
7409
__Pyx_RefNannyDeclarations
7410
__Pyx_RefNannySetupContext("have_same_parent", 0);
7411
7412
/* "sage/structure/element.pxd":155
7413
* True
7414
* """
7415
* return HAVE_SAME_PARENT(classify_elements(left, right)) # <<<<<<<<<<<<<<
7416
*
7417
*
7418
*/
7419
__pyx_r = __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(__pyx_f_4sage_9structure_7element_classify_elements(__pyx_v_left, __pyx_v_right));
7420
goto __pyx_L0;
7421
7422
/* "sage/structure/element.pxd":123
7423
*
7424
*
7425
* cpdef inline bint have_same_parent(left, right): # <<<<<<<<<<<<<<
7426
* """
7427
* Return ``True`` if and only if ``left`` and ``right`` have the
7428
*/
7429
7430
/* function exit code */
7431
__pyx_L0:;
7432
__Pyx_RefNannyFinishContext();
7433
return __pyx_r;
7434
}
7435
7436
/* Python wrapper */
7437
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7438
static char __pyx_doc_4sage_9structure_7element_2have_same_parent[] = "File: (starting at line 123)\n\n Return ``True`` if and only if ``left`` and ``right`` have the\n same parent.\n\n .. WARNING::\n\n This function assumes that at least one of the arguments is a\n Sage :class:`Element`. When in doubt, use the slower\n ``parent(left) is parent(right)`` instead.\n\n EXAMPLES::\n\n sage: from sage.structure.element import have_same_parent\n sage: have_same_parent(1, 3)\n True\n sage: have_same_parent(1, 1/2)\n False\n sage: have_same_parent(gap(1), gap(1/2))\n True\n\n These have different types but the same parent::\n\n sage: a = RLF(2)\n sage: b = exp(a)\n sage: type(a)\n <type 'sage.rings.real_lazy.LazyWrapper'>\n sage: type(b)\n <type 'sage.rings.real_lazy.LazyNamedUnop'>\n sage: have_same_parent(a, b)\n True\n ";
7439
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7440
PyObject *__pyx_v_left = 0;
7441
PyObject *__pyx_v_right = 0;
7442
PyObject *__pyx_r = 0;
7443
__Pyx_RefNannyDeclarations
7444
__Pyx_RefNannySetupContext("have_same_parent (wrapper)", 0);
7445
{
7446
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left,&__pyx_n_s_right,0};
7447
PyObject* values[2] = {0,0};
7448
if (unlikely(__pyx_kwds)) {
7449
Py_ssize_t kw_args;
7450
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7451
switch (pos_args) {
7452
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7453
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7454
case 0: break;
7455
default: goto __pyx_L5_argtuple_error;
7456
}
7457
kw_args = PyDict_Size(__pyx_kwds);
7458
switch (pos_args) {
7459
case 0:
7460
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
7461
else goto __pyx_L5_argtuple_error;
7462
case 1:
7463
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
7464
else {
7465
__Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, 1); __PYX_ERR(1, 123, __pyx_L3_error)
7466
}
7467
}
7468
if (unlikely(kw_args > 0)) {
7469
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "have_same_parent") < 0)) __PYX_ERR(1, 123, __pyx_L3_error)
7470
}
7471
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7472
goto __pyx_L5_argtuple_error;
7473
} else {
7474
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7475
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7476
}
7477
__pyx_v_left = values[0];
7478
__pyx_v_right = values[1];
7479
}
7480
goto __pyx_L4_argument_unpacking_done;
7481
__pyx_L5_argtuple_error:;
7482
__Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 123, __pyx_L3_error)
7483
__pyx_L3_error:;
7484
__Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
7485
__Pyx_RefNannyFinishContext();
7486
return NULL;
7487
__pyx_L4_argument_unpacking_done:;
7488
__pyx_r = __pyx_pf_4sage_9structure_7element_2have_same_parent(__pyx_self, __pyx_v_left, __pyx_v_right);
7489
7490
/* function exit code */
7491
__Pyx_RefNannyFinishContext();
7492
return __pyx_r;
7493
}
7494
7495
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
7496
PyObject *__pyx_r = NULL;
7497
__Pyx_RefNannyDeclarations
7498
PyObject *__pyx_t_1 = NULL;
7499
__Pyx_RefNannySetupContext("have_same_parent", 0);
7500
__Pyx_XDECREF(__pyx_r);
7501
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_7element_have_same_parent(__pyx_v_left, __pyx_v_right, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 123, __pyx_L1_error)
7502
__Pyx_GOTREF(__pyx_t_1);
7503
__pyx_r = __pyx_t_1;
7504
__pyx_t_1 = 0;
7505
goto __pyx_L0;
7506
7507
/* function exit code */
7508
__pyx_L1_error:;
7509
__Pyx_XDECREF(__pyx_t_1);
7510
__Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
7511
__pyx_r = NULL;
7512
__pyx_L0:;
7513
__Pyx_XGIVEREF(__pyx_r);
7514
__Pyx_RefNannyFinishContext();
7515
return __pyx_r;
7516
}
7517
7518
/* "sage/structure/element.pxd":158
7519
*
7520
*
7521
* cdef inline parent_c(x): # <<<<<<<<<<<<<<
7522
* """
7523
* Deprecated alias for :func:`parent`.
7524
*/
7525
7526
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent_c(PyObject *__pyx_v_x) {
7527
PyObject *__pyx_r = NULL;
7528
__Pyx_RefNannyDeclarations
7529
PyObject *__pyx_t_1 = NULL;
7530
__Pyx_RefNannySetupContext("parent_c", 0);
7531
7532
/* "sage/structure/element.pxd":162
7533
* Deprecated alias for :func:`parent`.
7534
* """
7535
* return parent(x) # <<<<<<<<<<<<<<
7536
*
7537
*
7538
*/
7539
__Pyx_XDECREF(__pyx_r);
7540
__pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 162, __pyx_L1_error)
7541
__Pyx_GOTREF(__pyx_t_1);
7542
__pyx_r = __pyx_t_1;
7543
__pyx_t_1 = 0;
7544
goto __pyx_L0;
7545
7546
/* "sage/structure/element.pxd":158
7547
*
7548
*
7549
* cdef inline parent_c(x): # <<<<<<<<<<<<<<
7550
* """
7551
* Deprecated alias for :func:`parent`.
7552
*/
7553
7554
/* function exit code */
7555
__pyx_L1_error:;
7556
__Pyx_XDECREF(__pyx_t_1);
7557
__Pyx_AddTraceback("sage.structure.element.parent_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
7558
__pyx_r = 0;
7559
__pyx_L0:;
7560
__Pyx_XGIVEREF(__pyx_r);
7561
__Pyx_RefNannyFinishContext();
7562
return __pyx_r;
7563
}
7564
7565
/* "parent.pxd":23
7566
* # Flags, see below
7567
* cdef int flags
7568
* cdef inline bint get_flag(self, int flag): # <<<<<<<<<<<<<<
7569
* return self.flags & flag
7570
*
7571
*/
7572
7573
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *__pyx_v_self, int __pyx_v_flag) {
7574
int __pyx_r;
7575
__Pyx_RefNannyDeclarations
7576
__Pyx_RefNannySetupContext("get_flag", 0);
7577
7578
/* "parent.pxd":24
7579
* cdef int flags
7580
* cdef inline bint get_flag(self, int flag):
7581
* return self.flags & flag # <<<<<<<<<<<<<<
7582
*
7583
* cpdef bint is_coercion_cached(self, domain)
7584
*/
7585
__pyx_r = (__pyx_v_self->flags & __pyx_v_flag);
7586
goto __pyx_L0;
7587
7588
/* "parent.pxd":23
7589
* # Flags, see below
7590
* cdef int flags
7591
* cdef inline bint get_flag(self, int flag): # <<<<<<<<<<<<<<
7592
* return self.flags & flag
7593
*
7594
*/
7595
7596
/* function exit code */
7597
__pyx_L0:;
7598
__Pyx_RefNannyFinishContext();
7599
return __pyx_r;
7600
}
7601
7602
/* "sage_object.pxd":13
7603
*
7604
*
7605
* cpdef inline richcmp_not_equal(x, y, int op): # <<<<<<<<<<<<<<
7606
* """
7607
* Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.
7608
*/
7609
7610
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7611
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op, CYTHON_UNUSED int __pyx_skip_dispatch) {
7612
PyObject *__pyx_r = NULL;
7613
__Pyx_RefNannyDeclarations
7614
int __pyx_t_1;
7615
PyObject *__pyx_t_2 = NULL;
7616
__Pyx_RefNannySetupContext("richcmp_not_equal", 0);
7617
7618
/* "sage_object.pxd":70
7619
* True
7620
* """
7621
* if op == Py_EQ: # <<<<<<<<<<<<<<
7622
* return False
7623
* elif op == Py_NE:
7624
*/
7625
__pyx_t_1 = ((__pyx_v_op == Py_EQ) != 0);
7626
if (__pyx_t_1) {
7627
7628
/* "sage_object.pxd":71
7629
* """
7630
* if op == Py_EQ:
7631
* return False # <<<<<<<<<<<<<<
7632
* elif op == Py_NE:
7633
* return True
7634
*/
7635
__Pyx_XDECREF(__pyx_r);
7636
__Pyx_INCREF(Py_False);
7637
__pyx_r = Py_False;
7638
goto __pyx_L0;
7639
7640
/* "sage_object.pxd":70
7641
* True
7642
* """
7643
* if op == Py_EQ: # <<<<<<<<<<<<<<
7644
* return False
7645
* elif op == Py_NE:
7646
*/
7647
}
7648
7649
/* "sage_object.pxd":72
7650
* if op == Py_EQ:
7651
* return False
7652
* elif op == Py_NE: # <<<<<<<<<<<<<<
7653
* return True
7654
* return richcmp(x, y, op)
7655
*/
7656
__pyx_t_1 = ((__pyx_v_op == Py_NE) != 0);
7657
if (__pyx_t_1) {
7658
7659
/* "sage_object.pxd":73
7660
* return False
7661
* elif op == Py_NE:
7662
* return True # <<<<<<<<<<<<<<
7663
* return richcmp(x, y, op)
7664
*
7665
*/
7666
__Pyx_XDECREF(__pyx_r);
7667
__Pyx_INCREF(Py_True);
7668
__pyx_r = Py_True;
7669
goto __pyx_L0;
7670
7671
/* "sage_object.pxd":72
7672
* if op == Py_EQ:
7673
* return False
7674
* elif op == Py_NE: # <<<<<<<<<<<<<<
7675
* return True
7676
* return richcmp(x, y, op)
7677
*/
7678
}
7679
7680
/* "sage_object.pxd":74
7681
* elif op == Py_NE:
7682
* return True
7683
* return richcmp(x, y, op) # <<<<<<<<<<<<<<
7684
*
7685
*
7686
*/
7687
__Pyx_XDECREF(__pyx_r);
7688
__pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_v_y, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 74, __pyx_L1_error)
7689
__Pyx_GOTREF(__pyx_t_2);
7690
__pyx_r = __pyx_t_2;
7691
__pyx_t_2 = 0;
7692
goto __pyx_L0;
7693
7694
/* "sage_object.pxd":13
7695
*
7696
*
7697
* cpdef inline richcmp_not_equal(x, y, int op): # <<<<<<<<<<<<<<
7698
* """
7699
* Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.
7700
*/
7701
7702
/* function exit code */
7703
__pyx_L1_error:;
7704
__Pyx_XDECREF(__pyx_t_2);
7705
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
7706
__pyx_r = 0;
7707
__pyx_L0:;
7708
__Pyx_XGIVEREF(__pyx_r);
7709
__Pyx_RefNannyFinishContext();
7710
return __pyx_r;
7711
}
7712
7713
/* Python wrapper */
7714
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7715
static char __pyx_doc_4sage_9structure_11sage_object_richcmp_not_equal[] = "File: (starting at line 13)\n\n Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.\n\n INPUT:\n\n - ``op`` -- a rich comparison operation (e.g. ``Py_EQ``)\n\n OUTPUT:\n\n If ``op`` is not ``op_EQ`` or ``op_NE``, the result of\n ``richcmp(x, y, op)``. If ``op`` is ``op_EQ``, return\n ``False``. If ``op`` is ``op_NE``, return ``True``.\n\n This is useful to compare lazily two objects A and B according to 2\n (or more) different parameters, say width and height for example.\n One could use::\n\n return richcmp((A.width(), A.height()), (B.width(), B.height()), op)\n\n but this will compute both width and height in all cases, even if\n A.width() and B.width() are enough to decide the comparison.\n\n Instead one can do::\n\n wA = A.width()\n wB = B.width()\n if wA != wB:\n return richcmp_not_equal(wA, wB, op)\n return richcmp(A.height(), B.height(), op)\n\n The difference with ``richcmp`` is that ``richcmp_not_equal``\n assumes that its arguments are not equal, which is excluding the case\n where the comparison cannot be decided so far, without\n knowing the rest of the parameters.\n\n EXAMPLES::\n\n sage: from sage.structure.sage_object import (richcmp_not_equal,\n ....: op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE)\n sage: for op in (op_LT, op_LE, op_EQ, op_NE, op_GT, op_GE):\n ....: print(richcmp_not_equal(3, 4, op))\n True\n True\n False\n True\n False\n False\n sage: for op in (op_LT, op_LE, op_EQ, op_NE, op_GT, op_GE):\n ....: print(richcmp_not_equal(5, 4, op))\n False\n False\n False\n True\n True\n True\n ";
7716
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7717
PyObject *__pyx_v_x = 0;
7718
PyObject *__pyx_v_y = 0;
7719
int __pyx_v_op;
7720
PyObject *__pyx_r = 0;
7721
__Pyx_RefNannyDeclarations
7722
__Pyx_RefNannySetupContext("richcmp_not_equal (wrapper)", 0);
7723
{
7724
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_op,0};
7725
PyObject* values[3] = {0,0,0};
7726
if (unlikely(__pyx_kwds)) {
7727
Py_ssize_t kw_args;
7728
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7729
switch (pos_args) {
7730
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7731
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7732
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7733
case 0: break;
7734
default: goto __pyx_L5_argtuple_error;
7735
}
7736
kw_args = PyDict_Size(__pyx_kwds);
7737
switch (pos_args) {
7738
case 0:
7739
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7740
else goto __pyx_L5_argtuple_error;
7741
case 1:
7742
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
7743
else {
7744
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, 1); __PYX_ERR(2, 13, __pyx_L3_error)
7745
}
7746
case 2:
7747
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
7748
else {
7749
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, 2); __PYX_ERR(2, 13, __pyx_L3_error)
7750
}
7751
}
7752
if (unlikely(kw_args > 0)) {
7753
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "richcmp_not_equal") < 0)) __PYX_ERR(2, 13, __pyx_L3_error)
7754
}
7755
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
7756
goto __pyx_L5_argtuple_error;
7757
} else {
7758
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7759
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7760
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7761
}
7762
__pyx_v_x = values[0];
7763
__pyx_v_y = values[1];
7764
__pyx_v_op = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 13, __pyx_L3_error)
7765
}
7766
goto __pyx_L4_argument_unpacking_done;
7767
__pyx_L5_argtuple_error:;
7768
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 13, __pyx_L3_error)
7769
__pyx_L3_error:;
7770
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
7771
__Pyx_RefNannyFinishContext();
7772
return NULL;
7773
__pyx_L4_argument_unpacking_done:;
7774
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_op);
7775
7776
/* function exit code */
7777
__Pyx_RefNannyFinishContext();
7778
return __pyx_r;
7779
}
7780
7781
static PyObject *__pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
7782
PyObject *__pyx_r = NULL;
7783
__Pyx_RefNannyDeclarations
7784
PyObject *__pyx_t_1 = NULL;
7785
__Pyx_RefNannySetupContext("richcmp_not_equal", 0);
7786
__Pyx_XDECREF(__pyx_r);
7787
__pyx_t_1 = __pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(__pyx_v_x, __pyx_v_y, __pyx_v_op, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
7788
__Pyx_GOTREF(__pyx_t_1);
7789
__pyx_r = __pyx_t_1;
7790
__pyx_t_1 = 0;
7791
goto __pyx_L0;
7792
7793
/* function exit code */
7794
__pyx_L1_error:;
7795
__Pyx_XDECREF(__pyx_t_1);
7796
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
7797
__pyx_r = NULL;
7798
__pyx_L0:;
7799
__Pyx_XGIVEREF(__pyx_r);
7800
__Pyx_RefNannyFinishContext();
7801
return __pyx_r;
7802
}
7803
7804
/* "sage_object.pxd":77
7805
*
7806
*
7807
* cpdef inline bint rich_to_bool(int op, int c): # <<<<<<<<<<<<<<
7808
* """
7809
* Return the corresponding ``True`` or ``False`` value for a rich
7810
*/
7811
7812
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7813
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool(int __pyx_v_op, int __pyx_v_c, CYTHON_UNUSED int __pyx_skip_dispatch) {
7814
uint32_t __pyx_v_less_bits;
7815
uint32_t __pyx_v_equal_bits;
7816
uint32_t __pyx_v_greater_bits;
7817
uint32_t __pyx_v_bits;
7818
int __pyx_v_shift;
7819
int __pyx_r;
7820
__Pyx_RefNannyDeclarations
7821
__Pyx_RefNannySetupContext("rich_to_bool", 0);
7822
7823
/* "sage_object.pxd":139
7824
* # The 4 lines below involve just constants, so the compiler should
7825
* # optimize them to just one constant value for "bits".
7826
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE) # <<<<<<<<<<<<<<
7827
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
7828
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
7829
*/
7830
__pyx_v_less_bits = (((1 << Py_LT) + (1 << Py_LE)) + (1 << Py_NE));
7831
7832
/* "sage_object.pxd":140
7833
* # optimize them to just one constant value for "bits".
7834
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE)
7835
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ) # <<<<<<<<<<<<<<
7836
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
7837
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
7838
*/
7839
__pyx_v_equal_bits = (((1 << Py_LE) + (1 << Py_GE)) + (1 << Py_EQ));
7840
7841
/* "sage_object.pxd":141
7842
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE)
7843
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
7844
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE) # <<<<<<<<<<<<<<
7845
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
7846
*
7847
*/
7848
__pyx_v_greater_bits = (((1 << Py_GT) + (1 << Py_GE)) + (1 << Py_NE));
7849
7850
/* "sage_object.pxd":142
7851
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
7852
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
7853
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8) # <<<<<<<<<<<<<<
7854
*
7855
* cdef int shift = 8*c + op
7856
*/
7857
__pyx_v_bits = (((__pyx_v_less_bits << 24) + __pyx_v_equal_bits) + (__pyx_v_greater_bits << 8));
7858
7859
/* "sage_object.pxd":144
7860
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
7861
*
7862
* cdef int shift = 8*c + op # <<<<<<<<<<<<<<
7863
*
7864
* # The shift masking (shift & 31) will likely be optimized away by
7865
*/
7866
__pyx_v_shift = ((8 * __pyx_v_c) + __pyx_v_op);
7867
7868
/* "sage_object.pxd":149
7869
* # the compiler since shift and bit test instructions implicitly
7870
* # mask their offset.
7871
* return (bits >> (shift & 31)) & 1 # <<<<<<<<<<<<<<
7872
*
7873
*
7874
*/
7875
__pyx_r = ((__pyx_v_bits >> (__pyx_v_shift & 31)) & 1);
7876
goto __pyx_L0;
7877
7878
/* "sage_object.pxd":77
7879
*
7880
*
7881
* cpdef inline bint rich_to_bool(int op, int c): # <<<<<<<<<<<<<<
7882
* """
7883
* Return the corresponding ``True`` or ``False`` value for a rich
7884
*/
7885
7886
/* function exit code */
7887
__pyx_L0:;
7888
__Pyx_RefNannyFinishContext();
7889
return __pyx_r;
7890
}
7891
7892
/* Python wrapper */
7893
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7894
static char __pyx_doc_4sage_9structure_11sage_object_2rich_to_bool[] = "File: (starting at line 77)\n\n Return the corresponding ``True`` or ``False`` value for a rich\n comparison, given the result of an ordinary comparison.\n\n INPUT:\n\n - ``op`` -- a rich comparison operation (e.g. ``Py_EQ``)\n\n - ``c`` -- the result of an ordinary comparison: -1, 0 or 1.\n\n OUTPUT: 1 or 0 (corresponding to ``True`` and ``False``)\n\n .. SEEALSO::\n\n ``rich_to_bool_sgn`` if ``c`` could be outside the [-1, 1]\n range.\n\n EXAMPLES::\n\n sage: from sage.structure.sage_object import (rich_to_bool,\n ....: op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE)\n sage: for op in (op_LT, op_LE, op_EQ, op_NE, op_GT, op_GE):\n ....: for c in (-1,0,1):\n ....: print(rich_to_bool(op, c))\n True False False\n True True False\n False True False\n True False True\n False False True\n False True True\n\n Indirect tests using integers::\n\n sage: 0 < 5, 5 < 5, 5 < -8\n (True, False, False)\n sage: 0 <= 5, 5 <= 5, 5 <= -8\n (True, True, False)\n sage: 0 >= 5, 5 >= 5, 5 >= -8\n (False, True, True)\n sage: 0 > 5, 5 > 5, 5 > -8\n (False, False, True)\n sage: 0 == 5, 5 == 5, 5 == -8\n (False, True, False)\n sage: 0 != 5, 5 != 5, 5 != -8\n (True, False, True)\n\n TESTS::\n\n sage: from sage.structure.sage_object import py_rich_to_bool\n sage: py_rich_to_bool(op_EQ, 0)\n doctest:...: DeprecationWarning: py_rich_to_bool is deprecated. Please use sage.structure.sage_object.rich_to_bool instead.\n See http://trac.sagemath.org/21128 for details.\n True\n ";
7895
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7896
int __pyx_v_op;
7897
int __pyx_v_c;
7898
PyObject *__pyx_r = 0;
7899
__Pyx_RefNannyDeclarations
7900
__Pyx_RefNannySetupContext("rich_to_bool (wrapper)", 0);
7901
{
7902
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_op,&__pyx_n_s_c,0};
7903
PyObject* values[2] = {0,0};
7904
if (unlikely(__pyx_kwds)) {
7905
Py_ssize_t kw_args;
7906
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7907
switch (pos_args) {
7908
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7909
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7910
case 0: break;
7911
default: goto __pyx_L5_argtuple_error;
7912
}
7913
kw_args = PyDict_Size(__pyx_kwds);
7914
switch (pos_args) {
7915
case 0:
7916
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
7917
else goto __pyx_L5_argtuple_error;
7918
case 1:
7919
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
7920
else {
7921
__Pyx_RaiseArgtupleInvalid("rich_to_bool", 1, 2, 2, 1); __PYX_ERR(2, 77, __pyx_L3_error)
7922
}
7923
}
7924
if (unlikely(kw_args > 0)) {
7925
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rich_to_bool") < 0)) __PYX_ERR(2, 77, __pyx_L3_error)
7926
}
7927
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
7928
goto __pyx_L5_argtuple_error;
7929
} else {
7930
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7931
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7932
}
7933
__pyx_v_op = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 77, __pyx_L3_error)
7934
__pyx_v_c = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 77, __pyx_L3_error)
7935
}
7936
goto __pyx_L4_argument_unpacking_done;
7937
__pyx_L5_argtuple_error:;
7938
__Pyx_RaiseArgtupleInvalid("rich_to_bool", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 77, __pyx_L3_error)
7939
__pyx_L3_error:;
7940
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
7941
__Pyx_RefNannyFinishContext();
7942
return NULL;
7943
__pyx_L4_argument_unpacking_done:;
7944
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(__pyx_self, __pyx_v_op, __pyx_v_c);
7945
7946
/* function exit code */
7947
__Pyx_RefNannyFinishContext();
7948
return __pyx_r;
7949
}
7950
7951
static PyObject *__pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c) {
7952
PyObject *__pyx_r = NULL;
7953
__Pyx_RefNannyDeclarations
7954
PyObject *__pyx_t_1 = NULL;
7955
__Pyx_RefNannySetupContext("rich_to_bool", 0);
7956
__Pyx_XDECREF(__pyx_r);
7957
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_11sage_object_rich_to_bool(__pyx_v_op, __pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 77, __pyx_L1_error)
7958
__Pyx_GOTREF(__pyx_t_1);
7959
__pyx_r = __pyx_t_1;
7960
__pyx_t_1 = 0;
7961
goto __pyx_L0;
7962
7963
/* function exit code */
7964
__pyx_L1_error:;
7965
__Pyx_XDECREF(__pyx_t_1);
7966
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
7967
__pyx_r = NULL;
7968
__pyx_L0:;
7969
__Pyx_XGIVEREF(__pyx_r);
7970
__Pyx_RefNannyFinishContext();
7971
return __pyx_r;
7972
}
7973
7974
/* "sage_object.pxd":152
7975
*
7976
*
7977
* cpdef inline bint rich_to_bool_sgn(int op, int c): # <<<<<<<<<<<<<<
7978
* """
7979
* Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`
7980
*/
7981
7982
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7983
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(int __pyx_v_op, int __pyx_v_c, CYTHON_UNUSED int __pyx_skip_dispatch) {
7984
int __pyx_r;
7985
__Pyx_RefNannyDeclarations
7986
__Pyx_RefNannySetupContext("rich_to_bool_sgn", 0);
7987
7988
/* "sage_object.pxd":161
7989
* This is in particular needed for ``mpz_cmp()``.
7990
* """
7991
* return rich_to_bool(op, (c > 0) - (c < 0)) # <<<<<<<<<<<<<<
7992
*/
7993
__pyx_r = __pyx_f_4sage_9structure_11sage_object_rich_to_bool(__pyx_v_op, ((__pyx_v_c > 0) - (__pyx_v_c < 0)), 0);
7994
goto __pyx_L0;
7995
7996
/* "sage_object.pxd":152
7997
*
7998
*
7999
* cpdef inline bint rich_to_bool_sgn(int op, int c): # <<<<<<<<<<<<<<
8000
* """
8001
* Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`
8002
*/
8003
8004
/* function exit code */
8005
__pyx_L0:;
8006
__Pyx_RefNannyFinishContext();
8007
return __pyx_r;
8008
}
8009
8010
/* Python wrapper */
8011
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8012
static char __pyx_doc_4sage_9structure_11sage_object_4rich_to_bool_sgn[] = "File: (starting at line 152)\n\n Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`\n instead of only `-1` and `1`.\n\n .. NOTE::\n\n This is in particular needed for ``mpz_cmp()``.\n ";
8013
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8014
int __pyx_v_op;
8015
int __pyx_v_c;
8016
PyObject *__pyx_r = 0;
8017
__Pyx_RefNannyDeclarations
8018
__Pyx_RefNannySetupContext("rich_to_bool_sgn (wrapper)", 0);
8019
{
8020
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_op,&__pyx_n_s_c,0};
8021
PyObject* values[2] = {0,0};
8022
if (unlikely(__pyx_kwds)) {
8023
Py_ssize_t kw_args;
8024
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8025
switch (pos_args) {
8026
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8027
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8028
case 0: break;
8029
default: goto __pyx_L5_argtuple_error;
8030
}
8031
kw_args = PyDict_Size(__pyx_kwds);
8032
switch (pos_args) {
8033
case 0:
8034
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
8035
else goto __pyx_L5_argtuple_error;
8036
case 1:
8037
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
8038
else {
8039
__Pyx_RaiseArgtupleInvalid("rich_to_bool_sgn", 1, 2, 2, 1); __PYX_ERR(2, 152, __pyx_L3_error)
8040
}
8041
}
8042
if (unlikely(kw_args > 0)) {
8043
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rich_to_bool_sgn") < 0)) __PYX_ERR(2, 152, __pyx_L3_error)
8044
}
8045
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
8046
goto __pyx_L5_argtuple_error;
8047
} else {
8048
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8049
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8050
}
8051
__pyx_v_op = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L3_error)
8052
__pyx_v_c = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L3_error)
8053
}
8054
goto __pyx_L4_argument_unpacking_done;
8055
__pyx_L5_argtuple_error:;
8056
__Pyx_RaiseArgtupleInvalid("rich_to_bool_sgn", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 152, __pyx_L3_error)
8057
__pyx_L3_error:;
8058
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool_sgn", __pyx_clineno, __pyx_lineno, __pyx_filename);
8059
__Pyx_RefNannyFinishContext();
8060
return NULL;
8061
__pyx_L4_argument_unpacking_done:;
8062
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(__pyx_self, __pyx_v_op, __pyx_v_c);
8063
8064
/* function exit code */
8065
__Pyx_RefNannyFinishContext();
8066
return __pyx_r;
8067
}
8068
8069
static PyObject *__pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c) {
8070
PyObject *__pyx_r = NULL;
8071
__Pyx_RefNannyDeclarations
8072
PyObject *__pyx_t_1 = NULL;
8073
__Pyx_RefNannySetupContext("rich_to_bool_sgn", 0);
8074
__Pyx_XDECREF(__pyx_r);
8075
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(__pyx_v_op, __pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 152, __pyx_L1_error)
8076
__Pyx_GOTREF(__pyx_t_1);
8077
__pyx_r = __pyx_t_1;
8078
__pyx_t_1 = 0;
8079
goto __pyx_L0;
8080
8081
/* function exit code */
8082
__pyx_L1_error:;
8083
__Pyx_XDECREF(__pyx_t_1);
8084
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool_sgn", __pyx_clineno, __pyx_lineno, __pyx_filename);
8085
__pyx_r = NULL;
8086
__pyx_L0:;
8087
__Pyx_XGIVEREF(__pyx_r);
8088
__Pyx_RefNannyFinishContext();
8089
return __pyx_r;
8090
}
8091
8092
/* "cfunc.to_py":65
8093
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8094
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
8095
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
8096
* """wrap(arg0, arg1, arg2: 'int')"""
8097
* return f(arg0, arg1, arg2)
8098
*/
8099
8100
/* Python wrapper */
8101
static PyObject *__pyx_pw_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8102
static char __pyx_doc_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap[] = "File: (starting at line 65)\nwrap(arg0, arg1, arg2: 'int')";
8103
static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap};
8104
static PyObject *__pyx_pw_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8105
PyObject *__pyx_v_arg0 = 0;
8106
PyObject *__pyx_v_arg1 = 0;
8107
int __pyx_v_arg2;
8108
PyObject *__pyx_r = 0;
8109
__Pyx_RefNannyDeclarations
8110
__Pyx_RefNannySetupContext("wrap (wrapper)", 0);
8111
{
8112
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg0,&__pyx_n_s_arg1,&__pyx_n_s_arg2,0};
8113
PyObject* values[3] = {0,0,0};
8114
if (unlikely(__pyx_kwds)) {
8115
Py_ssize_t kw_args;
8116
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8117
switch (pos_args) {
8118
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8119
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8120
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8121
case 0: break;
8122
default: goto __pyx_L5_argtuple_error;
8123
}
8124
kw_args = PyDict_Size(__pyx_kwds);
8125
switch (pos_args) {
8126
case 0:
8127
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg0)) != 0)) kw_args--;
8128
else goto __pyx_L5_argtuple_error;
8129
case 1:
8130
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg1)) != 0)) kw_args--;
8131
else {
8132
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, 1); __PYX_ERR(3, 65, __pyx_L3_error)
8133
}
8134
case 2:
8135
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg2)) != 0)) kw_args--;
8136
else {
8137
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, 2); __PYX_ERR(3, 65, __pyx_L3_error)
8138
}
8139
}
8140
if (unlikely(kw_args > 0)) {
8141
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(3, 65, __pyx_L3_error)
8142
}
8143
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8144
goto __pyx_L5_argtuple_error;
8145
} else {
8146
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8147
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8148
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8149
}
8150
__pyx_v_arg0 = values[0];
8151
__pyx_v_arg1 = values[1];
8152
__pyx_v_arg2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_arg2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 65, __pyx_L3_error)
8153
}
8154
goto __pyx_L4_argument_unpacking_done;
8155
__pyx_L5_argtuple_error:;
8156
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 65, __pyx_L3_error)
8157
__pyx_L3_error:;
8158
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
8159
__Pyx_RefNannyFinishContext();
8160
return NULL;
8161
__pyx_L4_argument_unpacking_done:;
8162
__pyx_r = __pyx_pf_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap(__pyx_self, __pyx_v_arg0, __pyx_v_arg1, __pyx_v_arg2);
8163
8164
/* function exit code */
8165
__Pyx_RefNannyFinishContext();
8166
return __pyx_r;
8167
}
8168
8169
static PyObject *__pyx_pf_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_arg0, PyObject *__pyx_v_arg1, int __pyx_v_arg2) {
8170
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_cur_scope;
8171
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_outer_scope;
8172
PyObject *__pyx_r = NULL;
8173
__Pyx_RefNannyDeclarations
8174
PyObject *__pyx_t_1 = NULL;
8175
__Pyx_RefNannySetupContext("wrap", 0);
8176
__pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self);
8177
__pyx_cur_scope = __pyx_outer_scope;
8178
8179
/* "cfunc.to_py":67
8180
* def wrap(object arg0, object arg1, int arg2):
8181
* """wrap(arg0, arg1, arg2: 'int')"""
8182
* return f(arg0, arg1, arg2) # <<<<<<<<<<<<<<
8183
* return wrap
8184
*
8185
*/
8186
__Pyx_XDECREF(__pyx_r);
8187
__pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_arg0, __pyx_v_arg1, __pyx_v_arg2); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 67, __pyx_L1_error)
8188
__Pyx_GOTREF(__pyx_t_1);
8189
__pyx_r = __pyx_t_1;
8190
__pyx_t_1 = 0;
8191
goto __pyx_L0;
8192
8193
/* "cfunc.to_py":65
8194
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8195
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
8196
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
8197
* """wrap(arg0, arg1, arg2: 'int')"""
8198
* return f(arg0, arg1, arg2)
8199
*/
8200
8201
/* function exit code */
8202
__pyx_L1_error:;
8203
__Pyx_XDECREF(__pyx_t_1);
8204
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
8205
__pyx_r = NULL;
8206
__pyx_L0:;
8207
__Pyx_XGIVEREF(__pyx_r);
8208
__Pyx_RefNannyFinishContext();
8209
return __pyx_r;
8210
}
8211
8212
/* "cfunc.to_py":64
8213
*
8214
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8215
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
8216
* def wrap(object arg0, object arg1, int arg2):
8217
* """wrap(arg0, arg1, arg2: 'int')"""
8218
*/
8219
8220
static PyObject *__Pyx_CFunc_object____object____object____int___to_py(PyObject *(*__pyx_v_f)(PyObject *, PyObject *, int)) {
8221
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_cur_scope;
8222
PyObject *__pyx_v_wrap = 0;
8223
PyObject *__pyx_r = NULL;
8224
__Pyx_RefNannyDeclarations
8225
PyObject *__pyx_t_1 = NULL;
8226
__Pyx_RefNannySetupContext("__Pyx_CFunc_object____object____object____int___to_py", 0);
8227
__pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, __pyx_empty_tuple, NULL);
8228
if (unlikely(!__pyx_cur_scope)) {
8229
__pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)Py_None);
8230
__Pyx_INCREF(Py_None);
8231
__PYX_ERR(3, 64, __pyx_L1_error)
8232
} else {
8233
__Pyx_GOTREF(__pyx_cur_scope);
8234
}
8235
__pyx_cur_scope->__pyx_v_f = __pyx_v_f;
8236
8237
/* "cfunc.to_py":65
8238
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8239
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
8240
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
8241
* """wrap(arg0, arg1, arg2: 'int')"""
8242
* return f(arg0, arg1, arg2)
8243
*/
8244
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_object____object, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 65, __pyx_L1_error)
8245
__Pyx_GOTREF(__pyx_t_1);
8246
__pyx_v_wrap = __pyx_t_1;
8247
__pyx_t_1 = 0;
8248
8249
/* "cfunc.to_py":68
8250
* """wrap(arg0, arg1, arg2: 'int')"""
8251
* return f(arg0, arg1, arg2)
8252
* return wrap # <<<<<<<<<<<<<<
8253
*
8254
*
8255
*/
8256
__Pyx_XDECREF(__pyx_r);
8257
__Pyx_INCREF(__pyx_v_wrap);
8258
__pyx_r = __pyx_v_wrap;
8259
goto __pyx_L0;
8260
8261
/* "cfunc.to_py":64
8262
*
8263
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8264
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
8265
* def wrap(object arg0, object arg1, int arg2):
8266
* """wrap(arg0, arg1, arg2: 'int')"""
8267
*/
8268
8269
/* function exit code */
8270
__pyx_L1_error:;
8271
__Pyx_XDECREF(__pyx_t_1);
8272
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
8273
__pyx_r = 0;
8274
__pyx_L0:;
8275
__Pyx_XDECREF(__pyx_v_wrap);
8276
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
8277
__Pyx_XGIVEREF(__pyx_r);
8278
__Pyx_RefNannyFinishContext();
8279
return __pyx_r;
8280
}
8281
8282
static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py[8];
8283
static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = 0;
8284
8285
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
8286
PyObject *o;
8287
if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py)))) {
8288
o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py];
8289
memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py));
8290
(void) PyObject_INIT(o, t);
8291
} else {
8292
o = (*t->tp_alloc)(t, 0);
8293
if (unlikely(!o)) return 0;
8294
}
8295
return o;
8296
}
8297
8298
static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyObject *o) {
8299
if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py)))) {
8300
__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)o);
8301
} else {
8302
(*Py_TYPE(o)->tp_free)(o);
8303
}
8304
}
8305
8306
static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = {
8307
PyVarObject_HEAD_INIT(0, 0)
8308
"code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5.__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py", /*tp_name*/
8309
sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py), /*tp_basicsize*/
8310
0, /*tp_itemsize*/
8311
__pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, /*tp_dealloc*/
8312
0, /*tp_print*/
8313
0, /*tp_getattr*/
8314
0, /*tp_setattr*/
8315
#if PY_MAJOR_VERSION < 3
8316
0, /*tp_compare*/
8317
#endif
8318
#if PY_MAJOR_VERSION >= 3
8319
0, /*tp_as_async*/
8320
#endif
8321
0, /*tp_repr*/
8322
0, /*tp_as_number*/
8323
0, /*tp_as_sequence*/
8324
0, /*tp_as_mapping*/
8325
0, /*tp_hash*/
8326
0, /*tp_call*/
8327
0, /*tp_str*/
8328
0, /*tp_getattro*/
8329
0, /*tp_setattro*/
8330
0, /*tp_as_buffer*/
8331
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
8332
0, /*tp_doc*/
8333
0, /*tp_traverse*/
8334
0, /*tp_clear*/
8335
0, /*tp_richcompare*/
8336
0, /*tp_weaklistoffset*/
8337
0, /*tp_iter*/
8338
0, /*tp_iternext*/
8339
0, /*tp_methods*/
8340
0, /*tp_members*/
8341
0, /*tp_getset*/
8342
0, /*tp_base*/
8343
0, /*tp_dict*/
8344
0, /*tp_descr_get*/
8345
0, /*tp_descr_set*/
8346
0, /*tp_dictoffset*/
8347
0, /*tp_init*/
8348
0, /*tp_alloc*/
8349
__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, /*tp_new*/
8350
0, /*tp_free*/
8351
0, /*tp_is_gc*/
8352
0, /*tp_bases*/
8353
0, /*tp_mro*/
8354
0, /*tp_cache*/
8355
0, /*tp_subclasses*/
8356
0, /*tp_weaklist*/
8357
0, /*tp_del*/
8358
0, /*tp_version_tag*/
8359
#if PY_VERSION_HEX >= 0x030400a1
8360
0, /*tp_finalize*/
8361
#endif
8362
};
8363
8364
static PyMethodDef __pyx_methods[] = {
8365
{0, 0, 0, 0}
8366
};
8367
8368
#if PY_MAJOR_VERSION >= 3
8369
static struct PyModuleDef __pyx_moduledef = {
8370
#if PY_VERSION_HEX < 0x03020000
8371
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
8372
#else
8373
PyModuleDef_HEAD_INIT,
8374
#endif
8375
"aplist_sqrt5",
8376
__pyx_k_File_aplist_sqrt5_pyx_starting_a, /* m_doc */
8377
-1, /* m_size */
8378
__pyx_methods /* m_methods */,
8379
NULL, /* m_reload */
8380
NULL, /* m_traverse */
8381
NULL, /* m_clear */
8382
NULL /* m_free */
8383
};
8384
#endif
8385
8386
static __Pyx_StringTabEntry __pyx_string_tab[] = {
8387
{&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
8388
{&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
8389
{&__pyx_n_s_Ax, __pyx_k_Ax, sizeof(__pyx_k_Ax), 0, 0, 1, 1},
8390
{&__pyx_n_s_Ay, __pyx_k_Ay, sizeof(__pyx_k_Ay), 0, 0, 1, 1},
8391
{&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
8392
{&__pyx_n_s_Bx, __pyx_k_Bx, sizeof(__pyx_k_Bx), 0, 0, 1, 1},
8393
{&__pyx_n_s_By, __pyx_k_By, sizeof(__pyx_k_By), 0, 0, 1, 1},
8394
{&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
8395
{&__pyx_kp_s_E_must_have_base_field_with_defi, __pyx_k_E_must_have_base_field_with_defi, sizeof(__pyx_k_E_must_have_base_field_with_defi), 0, 0, 1, 0},
8396
{&__pyx_n_s_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 0, 1, 1},
8397
{&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
8398
{&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
8399
{&__pyx_n_s_Pyx_CFunc_object____object, __pyx_k_Pyx_CFunc_object____object, sizeof(__pyx_k_Pyx_CFunc_object____object), 0, 0, 1, 1},
8400
{&__pyx_n_s_ResidueRing, __pyx_k_ResidueRing, sizeof(__pyx_k_ResidueRing), 0, 0, 1, 1},
8401
{&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
8402
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
8403
{&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1},
8404
{&__pyx_n_s_a2, __pyx_k_a2, sizeof(__pyx_k_a2), 0, 0, 1, 1},
8405
{&__pyx_n_s_a3, __pyx_k_a3, sizeof(__pyx_k_a3), 0, 0, 1, 1},
8406
{&__pyx_n_s_a4, __pyx_k_a4, sizeof(__pyx_k_a4), 0, 0, 1, 1},
8407
{&__pyx_n_s_a6, __pyx_k_a6, sizeof(__pyx_k_a6), 0, 0, 1, 1},
8408
{&__pyx_n_s_a_invariants, __pyx_k_a_invariants, sizeof(__pyx_k_a_invariants), 0, 0, 1, 1},
8409
{&__pyx_n_s_aplist, __pyx_k_aplist, sizeof(__pyx_k_aplist), 0, 0, 1, 1},
8410
{&__pyx_n_s_aplist_remaining_slow, __pyx_k_aplist_remaining_slow, sizeof(__pyx_k_aplist_remaining_slow), 0, 0, 1, 1},
8411
{&__pyx_n_s_aplist_short, __pyx_k_aplist_short, sizeof(__pyx_k_aplist_short), 0, 0, 1, 1},
8412
{&__pyx_n_s_arg0, __pyx_k_arg0, sizeof(__pyx_k_arg0), 0, 0, 1, 1},
8413
{&__pyx_n_s_arg1, __pyx_k_arg1, sizeof(__pyx_k_arg1), 0, 0, 1, 1},
8414
{&__pyx_n_s_arg2, __pyx_k_arg2, sizeof(__pyx_k_arg2), 0, 0, 1, 1},
8415
{&__pyx_n_s_b2, __pyx_k_b2, sizeof(__pyx_k_b2), 0, 0, 1, 1},
8416
{&__pyx_n_s_b4, __pyx_k_b4, sizeof(__pyx_k_b4), 0, 0, 1, 1},
8417
{&__pyx_n_s_b6, __pyx_k_b6, sizeof(__pyx_k_b6), 0, 0, 1, 1},
8418
{&__pyx_n_s_base_field, __pyx_k_base_field, sizeof(__pyx_k_base_field), 0, 0, 1, 1},
8419
{&__pyx_n_s_bound, __pyx_k_bound, sizeof(__pyx_k_bound), 0, 0, 1, 1},
8420
{&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
8421
{&__pyx_n_s_c4, __pyx_k_c4, sizeof(__pyx_k_c4), 0, 0, 1, 1},
8422
{&__pyx_n_s_c6, __pyx_k_c6, sizeof(__pyx_k_c6), 0, 0, 1, 1},
8423
{&__pyx_n_s_cardinality, __pyx_k_cardinality, sizeof(__pyx_k_cardinality), 0, 0, 1, 1},
8424
{&__pyx_n_s_cfunc_to_py, __pyx_k_cfunc_to_py, sizeof(__pyx_k_cfunc_to_py), 0, 0, 1, 1},
8425
{&__pyx_n_s_change_ring, __pyx_k_change_ring, sizeof(__pyx_k_change_ring), 0, 0, 1, 1},
8426
{&__pyx_n_s_code_alex_psage_psage_ellcurve_l, __pyx_k_code_alex_psage_psage_ellcurve_l, sizeof(__pyx_k_code_alex_psage_psage_ellcurve_l), 0, 0, 1, 1},
8427
{&__pyx_n_s_coefficients, __pyx_k_coefficients, sizeof(__pyx_k_coefficients), 0, 0, 1, 1},
8428
{&__pyx_kp_s_coefficients_of_the_input_curve, __pyx_k_coefficients_of_the_input_curve, sizeof(__pyx_k_coefficients_of_the_input_curve), 0, 0, 1, 0},
8429
{&__pyx_n_s_conductor, __pyx_k_conductor, sizeof(__pyx_k_conductor), 0, 0, 1, 1},
8430
{&__pyx_n_s_defining_polynomial, __pyx_k_defining_polynomial, sizeof(__pyx_k_defining_polynomial), 0, 0, 1, 1},
8431
{&__pyx_n_s_elliptic_curve_ap, __pyx_k_elliptic_curve_ap, sizeof(__pyx_k_elliptic_curve_ap), 0, 0, 1, 1},
8432
{&__pyx_n_s_fast_only, __pyx_k_fast_only, sizeof(__pyx_k_fast_only), 0, 0, 1, 1},
8433
{&__pyx_n_s_global_minimal_model, __pyx_k_global_minimal_model, sizeof(__pyx_k_global_minimal_model), 0, 0, 1, 1},
8434
{&__pyx_n_s_has_split_multiplicative_reducti, __pyx_k_has_split_multiplicative_reducti, sizeof(__pyx_k_has_split_multiplicative_reducti), 0, 0, 1, 1},
8435
{&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
8436
{&__pyx_n_s_ideal, __pyx_k_ideal, sizeof(__pyx_k_ideal), 0, 0, 1, 1},
8437
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
8438
{&__pyx_kp_s_input_lists_v_and_primes_must_ha, __pyx_k_input_lists_v_and_primes_must_ha, sizeof(__pyx_k_input_lists_v_and_primes_must_ha), 0, 0, 1, 0},
8439
{&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
8440
{&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
8441
{&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
8442
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
8443
{&__pyx_n_s_op, __pyx_k_op, sizeof(__pyx_k_op), 0, 0, 1, 1},
8444
{&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
8445
{&__pyx_n_s_primes, __pyx_k_primes, sizeof(__pyx_k_primes), 0, 0, 1, 1},
8446
{&__pyx_n_s_primes_of_bounded_norm, __pyx_k_primes_of_bounded_norm, sizeof(__pyx_k_primes_of_bounded_norm), 0, 0, 1, 1},
8447
{&__pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_k_projects_68c8b2b8_03ba_44d4_a0d, sizeof(__pyx_k_projects_68c8b2b8_03ba_44d4_a0d), 0, 0, 1, 0},
8448
{&__pyx_n_s_psage_libs_smalljac_wrapper1, __pyx_k_psage_libs_smalljac_wrapper1, sizeof(__pyx_k_psage_libs_smalljac_wrapper1), 0, 0, 1, 1},
8449
{&__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt, __pyx_k_psage_modform_hilbert_sqrt5_sqrt, sizeof(__pyx_k_psage_modform_hilbert_sqrt5_sqrt), 0, 0, 1, 1},
8450
{&__pyx_n_s_psage_number_fields_sqrt5_misc, __pyx_k_psage_number_fields_sqrt5_misc, sizeof(__pyx_k_psage_number_fields_sqrt5_misc), 0, 0, 1, 1},
8451
{&__pyx_n_s_psage_number_fields_sqrt5_prime, __pyx_k_psage_number_fields_sqrt5_prime, sizeof(__pyx_k_psage_number_fields_sqrt5_prime), 0, 0, 1, 1},
8452
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
8453
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
8454
{&__pyx_n_s_residue_field, __pyx_k_residue_field, sizeof(__pyx_k_residue_field), 0, 0, 1, 1},
8455
{&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
8456
{&__pyx_n_s_sage_ideal, __pyx_k_sage_ideal, sizeof(__pyx_k_sage_ideal), 0, 0, 1, 1},
8457
{&__pyx_n_s_short_weierstrass_invariants, __pyx_k_short_weierstrass_invariants, sizeof(__pyx_k_short_weierstrass_invariants), 0, 0, 1, 1},
8458
{&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
8459
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
8460
{&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
8461
{&__pyx_n_s_valuation, __pyx_k_valuation, sizeof(__pyx_k_valuation), 0, 0, 1, 1},
8462
{&__pyx_n_s_wrap, __pyx_k_wrap, sizeof(__pyx_k_wrap), 0, 0, 1, 1},
8463
{&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
8464
{&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
8465
{&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
8466
{0, 0, 0, 0, 0, 0, 0}
8467
};
8468
static int __Pyx_InitCachedBuiltins(void) {
8469
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 152, __pyx_L1_error)
8470
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 203, __pyx_L1_error)
8471
__pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 269, __pyx_L1_error)
8472
__pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(1, 70, __pyx_L1_error)
8473
return 0;
8474
__pyx_L1_error:;
8475
return -1;
8476
}
8477
8478
static int __Pyx_InitCachedConstants(void) {
8479
__Pyx_RefNannyDeclarations
8480
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
8481
8482
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":343
8483
* R.pow(z, a4, 3)
8484
* R.mul(w, a6, a6)
8485
* R.coerce_from_nf(x, F(64)) # <<<<<<<<<<<<<<
8486
* R.mul(z, z, x)
8487
* R.coerce_from_nf(x, F(432))
8488
*/
8489
__pyx_tuple_ = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 343, __pyx_L1_error)
8490
__Pyx_GOTREF(__pyx_tuple_);
8491
__Pyx_GIVEREF(__pyx_tuple_);
8492
8493
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":345
8494
* R.coerce_from_nf(x, F(64))
8495
* R.mul(z, z, x)
8496
* R.coerce_from_nf(x, F(432)) # <<<<<<<<<<<<<<
8497
* R.mul(w, w, x)
8498
* R.add(z, z, w)
8499
*/
8500
__pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_432); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 345, __pyx_L1_error)
8501
__Pyx_GOTREF(__pyx_tuple__2);
8502
__Pyx_GIVEREF(__pyx_tuple__2);
8503
8504
/* "cfunc.to_py":65
8505
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8506
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
8507
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
8508
* """wrap(arg0, arg1, arg2: 'int')"""
8509
* return f(arg0, arg1, arg2)
8510
*/
8511
__pyx_tuple__3 = PyTuple_Pack(3, __pyx_n_s_arg0, __pyx_n_s_arg1, __pyx_n_s_arg2); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(3, 65, __pyx_L1_error)
8512
__Pyx_GOTREF(__pyx_tuple__3);
8513
__Pyx_GIVEREF(__pyx_tuple__3);
8514
__pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(3, 65, __pyx_L1_error)
8515
8516
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":54
8517
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing
8518
*
8519
* def short_weierstrass_invariants(E): # <<<<<<<<<<<<<<
8520
* """
8521
* Compute the invariants of a short Weierstrass form of E.
8522
*/
8523
__pyx_tuple__5 = PyTuple_Pack(13, __pyx_n_s_E, __pyx_n_s_a1, __pyx_n_s_a2, __pyx_n_s_a3, __pyx_n_s_a4, __pyx_n_s_a6, __pyx_n_s_b2, __pyx_n_s_b4, __pyx_n_s_b6, __pyx_n_s_c4, __pyx_n_s_c6, __pyx_n_s_A, __pyx_n_s_B); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 54, __pyx_L1_error)
8524
__Pyx_GOTREF(__pyx_tuple__5);
8525
__Pyx_GIVEREF(__pyx_tuple__5);
8526
__pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_short_weierstrass_invariants, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 54, __pyx_L1_error)
8527
8528
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":93
8529
* return A, B
8530
*
8531
* def aplist(E, bound, fast_only=False): # <<<<<<<<<<<<<<
8532
* """
8533
* Compute the traces of Frobenius `a_P` of the elliptic curve E over Q(sqrt(5)) for
8534
*/
8535
__pyx_tuple__7 = PyTuple_Pack(7, __pyx_n_s_E, __pyx_n_s_bound, __pyx_n_s_fast_only, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_primes, __pyx_n_s_v); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 93, __pyx_L1_error)
8536
__Pyx_GOTREF(__pyx_tuple__7);
8537
__Pyx_GIVEREF(__pyx_tuple__7);
8538
__pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_aplist, 93, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 93, __pyx_L1_error)
8539
8540
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":160
8541
* return v
8542
*
8543
* def aplist_remaining_slow(E, v, primes): # <<<<<<<<<<<<<<
8544
* """
8545
* Compute -- using possibly very slow methods -- the `a_P` in the
8546
*/
8547
__pyx_tuple__9 = PyTuple_Pack(9, __pyx_n_s_E, __pyx_n_s_v, __pyx_n_s_primes, __pyx_n_s_i, __pyx_n_s_F, __pyx_n_s_N, __pyx_n_s_P, __pyx_n_s_m, __pyx_n_s_k); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 160, __pyx_L1_error)
8548
__Pyx_GOTREF(__pyx_tuple__9);
8549
__Pyx_GIVEREF(__pyx_tuple__9);
8550
__pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_aplist_remaining_slow, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 160, __pyx_L1_error)
8551
8552
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":218
8553
* v[i] = k.cardinality() + 1 - F.change_ring(k).cardinality()
8554
*
8555
* def aplist_short(A, B, primes): # <<<<<<<<<<<<<<
8556
* """
8557
* Return list of `a_P` values that can be quickly computed for the
8558
*/
8559
__pyx_tuple__11 = PyTuple_Pack(10, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_primes, __pyx_n_s_Ax, __pyx_n_s_Ay, __pyx_n_s_Bx, __pyx_n_s_By, __pyx_n_s_v, __pyx_n_s_z, __pyx_n_s_N); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 218, __pyx_L1_error)
8560
__Pyx_GOTREF(__pyx_tuple__11);
8561
__Pyx_GIVEREF(__pyx_tuple__11);
8562
__pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_aplist_short, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 218, __pyx_L1_error)
8563
__Pyx_RefNannyFinishContext();
8564
return 0;
8565
__pyx_L1_error:;
8566
__Pyx_RefNannyFinishContext();
8567
return -1;
8568
}
8569
8570
static int __Pyx_InitGlobals(void) {
8571
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8572
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
8573
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
8574
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
8575
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
8576
__pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
8577
__pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
8578
__pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
8579
__pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) __PYX_ERR(0, 1, __pyx_L1_error)
8580
__pyx_int_36 = PyInt_FromLong(36); if (unlikely(!__pyx_int_36)) __PYX_ERR(0, 1, __pyx_L1_error)
8581
__pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error)
8582
__pyx_int_216 = PyInt_FromLong(216); if (unlikely(!__pyx_int_216)) __PYX_ERR(0, 1, __pyx_L1_error)
8583
__pyx_int_432 = PyInt_FromLong(432); if (unlikely(!__pyx_int_432)) __PYX_ERR(0, 1, __pyx_L1_error)
8584
__pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
8585
__pyx_int_neg_27 = PyInt_FromLong(-27); if (unlikely(!__pyx_int_neg_27)) __PYX_ERR(0, 1, __pyx_L1_error)
8586
__pyx_int_neg_54 = PyInt_FromLong(-54); if (unlikely(!__pyx_int_neg_54)) __PYX_ERR(0, 1, __pyx_L1_error)
8587
return 0;
8588
__pyx_L1_error:;
8589
return -1;
8590
}
8591
8592
#if PY_MAJOR_VERSION < 3
8593
PyMODINIT_FUNC initaplist_sqrt5(void); /*proto*/
8594
PyMODINIT_FUNC initaplist_sqrt5(void)
8595
#else
8596
PyMODINIT_FUNC PyInit_aplist_sqrt5(void); /*proto*/
8597
PyMODINIT_FUNC PyInit_aplist_sqrt5(void)
8598
#endif
8599
{
8600
PyObject *__pyx_t_1 = NULL;
8601
PyObject *__pyx_t_2 = NULL;
8602
PyObject *__pyx_t_3 = NULL;
8603
__Pyx_RefNannyDeclarations
8604
#if CYTHON_REFNANNY
8605
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
8606
if (!__Pyx_RefNanny) {
8607
PyErr_Clear();
8608
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
8609
if (!__Pyx_RefNanny)
8610
Py_FatalError("failed to import 'refnanny' module");
8611
}
8612
#endif
8613
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_aplist_sqrt5(void)", 0);
8614
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8615
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
8616
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
8617
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
8618
#ifdef __Pyx_CyFunction_USED
8619
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8620
#endif
8621
#ifdef __Pyx_FusedFunction_USED
8622
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8623
#endif
8624
#ifdef __Pyx_Coroutine_USED
8625
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8626
#endif
8627
#ifdef __Pyx_Generator_USED
8628
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8629
#endif
8630
#ifdef __Pyx_StopAsyncIteration_USED
8631
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8632
#endif
8633
/*--- Library function declarations ---*/
8634
/*--- Threads initialization code ---*/
8635
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
8636
#ifdef WITH_THREAD /* Python build with threading support? */
8637
PyEval_InitThreads();
8638
#endif
8639
#endif
8640
/*--- Module creation code ---*/
8641
#if PY_MAJOR_VERSION < 3
8642
__pyx_m = Py_InitModule4("aplist_sqrt5", __pyx_methods, __pyx_k_File_aplist_sqrt5_pyx_starting_a, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
8643
#else
8644
__pyx_m = PyModule_Create(&__pyx_moduledef);
8645
#endif
8646
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
8647
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
8648
Py_INCREF(__pyx_d);
8649
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
8650
#if CYTHON_COMPILING_IN_PYPY
8651
Py_INCREF(__pyx_b);
8652
#endif
8653
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8654
/*--- Initialize various global constants etc. ---*/
8655
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8656
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
8657
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8658
#endif
8659
if (__pyx_module_is_main_code__alex__psage__psage__ellcurve__lseries__aplist_sqrt5) {
8660
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8661
}
8662
#if PY_MAJOR_VERSION >= 3
8663
{
8664
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
8665
if (!PyDict_GetItemString(modules, "code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5")) {
8666
if (unlikely(PyDict_SetItemString(modules, "code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
8667
}
8668
}
8669
#endif
8670
/*--- Builtin init code ---*/
8671
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8672
/*--- Constants init code ---*/
8673
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8674
/*--- Global init code ---*/
8675
/*--- Variable export code ---*/
8676
/*--- Function export code ---*/
8677
/*--- Type init code ---*/
8678
if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py) < 0) __PYX_ERR(3, 64, __pyx_L1_error)
8679
__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py.tp_print = 0;
8680
__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = &__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py;
8681
/*--- Type import code ---*/
8682
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
8683
#if CYTHON_COMPILING_IN_PYPY
8684
sizeof(PyTypeObject),
8685
#else
8686
sizeof(PyHeapTypeObject),
8687
#endif
8688
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(4, 9, __pyx_L1_error)
8689
__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(5, 8, __pyx_L1_error)
8690
__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(6, 15, __pyx_L1_error)
8691
__pyx_ptype_4sage_9structure_11sage_object_SageObject = __Pyx_ImportType("sage.structure.sage_object", "SageObject", sizeof(struct __pyx_obj_4sage_9structure_11sage_object_SageObject), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11sage_object_SageObject)) __PYX_ERR(2, 9, __pyx_L1_error)
8692
__pyx_ptype_4sage_9structure_15category_object_CategoryObject = __Pyx_ImportType("sage.structure.category_object", "CategoryObject", sizeof(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject), 1); if (unlikely(!__pyx_ptype_4sage_9structure_15category_object_CategoryObject)) __PYX_ERR(7, 15, __pyx_L1_error)
8693
__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject = (struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_15category_object_CategoryObject->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject)) __PYX_ERR(7, 15, __pyx_L1_error)
8694
__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = __Pyx_ImportType("sage.structure.coerce_dict", "MonoDict", sizeof(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict)) __PYX_ERR(8, 7, __pyx_L1_error)
8695
__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict = (struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict)) __PYX_ERR(8, 7, __pyx_L1_error)
8696
__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = __Pyx_ImportType("sage.structure.coerce_dict", "TripleDict", sizeof(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict)) __PYX_ERR(8, 23, __pyx_L1_error)
8697
__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict = (struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict)) __PYX_ERR(8, 23, __pyx_L1_error)
8698
__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = __Pyx_ImportType("sage.misc.inherit_comparison", "InheritComparisonMetaclass", sizeof(struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass), 1); if (unlikely(!__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass)) __PYX_ERR(9, 3, __pyx_L1_error)
8699
__pyx_ptype_4sage_9structure_6parent_Parent = __Pyx_ImportType("sage.structure.parent", "Parent", sizeof(struct __pyx_obj_4sage_9structure_6parent_Parent), 1); if (unlikely(!__pyx_ptype_4sage_9structure_6parent_Parent)) __PYX_ERR(10, 12, __pyx_L1_error)
8700
__pyx_vtabptr_4sage_9structure_6parent_Parent = (struct __pyx_vtabstruct_4sage_9structure_6parent_Parent*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_6parent_Parent->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_6parent_Parent)) __PYX_ERR(10, 12, __pyx_L1_error)
8701
__pyx_ptype_4sage_9structure_7element_Element = __Pyx_ImportType("sage.structure.element", "Element", sizeof(struct __pyx_obj_4sage_9structure_7element_Element), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_Element)) __PYX_ERR(1, 169, __pyx_L1_error)
8702
__pyx_vtabptr_4sage_9structure_7element_Element = (struct __pyx_vtabstruct_4sage_9structure_7element_Element*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Element->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Element)) __PYX_ERR(1, 169, __pyx_L1_error)
8703
__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = __Pyx_ImportType("sage.structure.element", "ElementWithCachedMethod", sizeof(struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod)) __PYX_ERR(1, 192, __pyx_L1_error)
8704
__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod = (struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod)) __PYX_ERR(1, 192, __pyx_L1_error)
8705
__pyx_ptype_4sage_9structure_7element_ModuleElement = __Pyx_ImportType("sage.structure.element", "ModuleElement", sizeof(struct __pyx_obj_4sage_9structure_7element_ModuleElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_ModuleElement)) __PYX_ERR(1, 195, __pyx_L1_error)
8706
__pyx_vtabptr_4sage_9structure_7element_ModuleElement = (struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ModuleElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ModuleElement)) __PYX_ERR(1, 195, __pyx_L1_error)
8707
__pyx_ptype_4sage_9structure_7element_RingElement = __Pyx_ImportType("sage.structure.element", "RingElement", sizeof(struct __pyx_obj_4sage_9structure_7element_RingElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_RingElement)) __PYX_ERR(1, 197, __pyx_L1_error)
8708
__pyx_vtabptr_4sage_9structure_7element_RingElement = (struct __pyx_vtabstruct_4sage_9structure_7element_RingElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_RingElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_RingElement)) __PYX_ERR(1, 197, __pyx_L1_error)
8709
__pyx_ptype_4sage_9structure_7element_MonoidElement = __Pyx_ImportType("sage.structure.element", "MonoidElement", sizeof(struct __pyx_obj_4sage_9structure_7element_MonoidElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_MonoidElement)) __PYX_ERR(1, 208, __pyx_L1_error)
8710
__pyx_vtabptr_4sage_9structure_7element_MonoidElement = (struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_MonoidElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_MonoidElement)) __PYX_ERR(1, 208, __pyx_L1_error)
8711
__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = __Pyx_ImportType("sage.structure.element", "MultiplicativeGroupElement", sizeof(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement)) __PYX_ERR(1, 211, __pyx_L1_error)
8712
__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement = (struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement)) __PYX_ERR(1, 211, __pyx_L1_error)
8713
__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = __Pyx_ImportType("sage.structure.element", "AdditiveGroupElement", sizeof(struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement)) __PYX_ERR(1, 214, __pyx_L1_error)
8714
__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement = (struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement)) __PYX_ERR(1, 214, __pyx_L1_error)
8715
__pyx_ptype_4sage_9structure_7element_CommutativeRingElement = __Pyx_ImportType("sage.structure.element", "CommutativeRingElement", sizeof(struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_CommutativeRingElement)) __PYX_ERR(1, 220, __pyx_L1_error)
8716
__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement = (struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CommutativeRingElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement)) __PYX_ERR(1, 220, __pyx_L1_error)
8717
__pyx_ptype_4sage_9structure_7element_IntegralDomainElement = __Pyx_ImportType("sage.structure.element", "IntegralDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_IntegralDomainElement)) __PYX_ERR(1, 223, __pyx_L1_error)
8718
__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_IntegralDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement)) __PYX_ERR(1, 223, __pyx_L1_error)
8719
__pyx_ptype_4sage_9structure_7element_DedekindDomainElement = __Pyx_ImportType("sage.structure.element", "DedekindDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_DedekindDomainElement)) __PYX_ERR(1, 226, __pyx_L1_error)
8720
__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_DedekindDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement)) __PYX_ERR(1, 226, __pyx_L1_error)
8721
__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = __Pyx_ImportType("sage.structure.element", "PrincipalIdealDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement)) __PYX_ERR(1, 229, __pyx_L1_error)
8722
__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement)) __PYX_ERR(1, 229, __pyx_L1_error)
8723
__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = __Pyx_ImportType("sage.structure.element", "EuclideanDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement)) __PYX_ERR(1, 232, __pyx_L1_error)
8724
__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement)) __PYX_ERR(1, 232, __pyx_L1_error)
8725
__pyx_ptype_4sage_9structure_7element_FieldElement = __Pyx_ImportType("sage.structure.element", "FieldElement", sizeof(struct __pyx_obj_4sage_9structure_7element_FieldElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_FieldElement)) __PYX_ERR(1, 236, __pyx_L1_error)
8726
__pyx_vtabptr_4sage_9structure_7element_FieldElement = (struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_FieldElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_FieldElement)) __PYX_ERR(1, 236, __pyx_L1_error)
8727
__pyx_ptype_4sage_9structure_7element_AlgebraElement = __Pyx_ImportType("sage.structure.element", "AlgebraElement", sizeof(struct __pyx_obj_4sage_9structure_7element_AlgebraElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_AlgebraElement)) __PYX_ERR(1, 239, __pyx_L1_error)
8728
__pyx_vtabptr_4sage_9structure_7element_AlgebraElement = (struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_AlgebraElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_AlgebraElement)) __PYX_ERR(1, 239, __pyx_L1_error)
8729
__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = __Pyx_ImportType("sage.structure.element", "CommutativeAlgebraElement", sizeof(struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement)) __PYX_ERR(1, 242, __pyx_L1_error)
8730
__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement = (struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement)) __PYX_ERR(1, 242, __pyx_L1_error)
8731
__pyx_ptype_4sage_9structure_7element_InfinityElement = __Pyx_ImportType("sage.structure.element", "InfinityElement", sizeof(struct __pyx_obj_4sage_9structure_7element_InfinityElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_InfinityElement)) __PYX_ERR(1, 245, __pyx_L1_error)
8732
__pyx_vtabptr_4sage_9structure_7element_InfinityElement = (struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_InfinityElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_InfinityElement)) __PYX_ERR(1, 245, __pyx_L1_error)
8733
__pyx_ptype_4sage_9structure_7element_Vector = __Pyx_ImportType("sage.structure.element", "Vector", sizeof(struct __pyx_obj_4sage_9structure_7element_Vector), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_Vector)) __PYX_ERR(1, 249, __pyx_L1_error)
8734
__pyx_vtabptr_4sage_9structure_7element_Vector = (struct __pyx_vtabstruct_4sage_9structure_7element_Vector*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Vector->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Vector)) __PYX_ERR(1, 249, __pyx_L1_error)
8735
__pyx_ptype_4sage_9structure_7element_Matrix = __Pyx_ImportType("sage.structure.element", "Matrix", sizeof(struct __pyx_obj_4sage_9structure_7element_Matrix), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_Matrix)) __PYX_ERR(1, 264, __pyx_L1_error)
8736
__pyx_vtabptr_4sage_9structure_7element_Matrix = (struct __pyx_vtabstruct_4sage_9structure_7element_Matrix*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Matrix->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Matrix)) __PYX_ERR(1, 264, __pyx_L1_error)
8737
__pyx_ptype_4sage_9structure_7element_CoercionModel = __Pyx_ImportType("sage.structure.element", "CoercionModel", sizeof(struct __pyx_obj_4sage_9structure_7element_CoercionModel), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_CoercionModel)) __PYX_ERR(1, 277, __pyx_L1_error)
8738
__pyx_vtabptr_4sage_9structure_7element_CoercionModel = (struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CoercionModel->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CoercionModel)) __PYX_ERR(1, 277, __pyx_L1_error)
8739
__pyx_ptype_4sage_10categories_3map_Map = __Pyx_ImportType("sage.categories.map", "Map", sizeof(struct __pyx_obj_4sage_10categories_3map_Map), 1); if (unlikely(!__pyx_ptype_4sage_10categories_3map_Map)) __PYX_ERR(11, 4, __pyx_L1_error)
8740
__pyx_vtabptr_4sage_10categories_3map_Map = (struct __pyx_vtabstruct_4sage_10categories_3map_Map*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_Map->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_Map)) __PYX_ERR(11, 4, __pyx_L1_error)
8741
__pyx_ptype_4sage_10categories_3map_Section = __Pyx_ImportType("sage.categories.map", "Section", sizeof(struct __pyx_obj_4sage_10categories_3map_Section), 1); if (unlikely(!__pyx_ptype_4sage_10categories_3map_Section)) __PYX_ERR(11, 25, __pyx_L1_error)
8742
__pyx_vtabptr_4sage_10categories_3map_Section = (struct __pyx_vtabstruct_4sage_10categories_3map_Section*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_Section->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_Section)) __PYX_ERR(11, 25, __pyx_L1_error)
8743
__pyx_ptype_4sage_10categories_3map_FormalCompositeMap = __Pyx_ImportType("sage.categories.map", "FormalCompositeMap", sizeof(struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap), 1); if (unlikely(!__pyx_ptype_4sage_10categories_3map_FormalCompositeMap)) __PYX_ERR(11, 28, __pyx_L1_error)
8744
__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap = (struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_FormalCompositeMap->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap)) __PYX_ERR(11, 28, __pyx_L1_error)
8745
__pyx_ptype_4sage_10categories_8morphism_Morphism = __Pyx_ImportType("sage.categories.morphism", "Morphism", sizeof(struct __pyx_obj_4sage_10categories_8morphism_Morphism), 1); if (unlikely(!__pyx_ptype_4sage_10categories_8morphism_Morphism)) __PYX_ERR(12, 5, __pyx_L1_error)
8746
__pyx_vtabptr_4sage_10categories_8morphism_Morphism = (struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_8morphism_Morphism->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_8morphism_Morphism)) __PYX_ERR(12, 5, __pyx_L1_error)
8747
__pyx_ptype_4sage_10categories_8morphism_SetMorphism = __Pyx_ImportType("sage.categories.morphism", "SetMorphism", sizeof(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism), 1); if (unlikely(!__pyx_ptype_4sage_10categories_8morphism_SetMorphism)) __PYX_ERR(12, 8, __pyx_L1_error)
8748
__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism = (struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_8morphism_SetMorphism->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism)) __PYX_ERR(12, 8, __pyx_L1_error)
8749
__pyx_ptype_4sage_5rings_7integer_Integer = __Pyx_ImportType("sage.rings.integer", "Integer", sizeof(struct __pyx_obj_4sage_5rings_7integer_Integer), 1); if (unlikely(!__pyx_ptype_4sage_5rings_7integer_Integer)) __PYX_ERR(13, 7, __pyx_L1_error)
8750
__pyx_vtabptr_4sage_5rings_7integer_Integer = (struct __pyx_vtabstruct_4sage_5rings_7integer_Integer*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_7integer_Integer->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_7integer_Integer)) __PYX_ERR(13, 7, __pyx_L1_error)
8751
__pyx_ptype_4sage_5rings_7integer_int_to_Z = __Pyx_ImportType("sage.rings.integer", "int_to_Z", sizeof(struct __pyx_obj_4sage_5rings_7integer_int_to_Z), 1); if (unlikely(!__pyx_ptype_4sage_5rings_7integer_int_to_Z)) __PYX_ERR(13, 37, __pyx_L1_error)
8752
__pyx_vtabptr_4sage_5rings_7integer_int_to_Z = (struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_7integer_int_to_Z->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_7integer_int_to_Z)) __PYX_ERR(13, 37, __pyx_L1_error)
8753
__pyx_ptype_4sage_9structure_10parent_old_Parent = __Pyx_ImportType("sage.structure.parent_old", "Parent", sizeof(struct __pyx_obj_4sage_9structure_10parent_old_Parent), 1); if (unlikely(!__pyx_ptype_4sage_9structure_10parent_old_Parent)) __PYX_ERR(14, 15, __pyx_L1_error)
8754
__pyx_vtabptr_4sage_9structure_10parent_old_Parent = (struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_10parent_old_Parent->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_10parent_old_Parent)) __PYX_ERR(14, 15, __pyx_L1_error)
8755
__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase = __Pyx_ImportType("sage.structure.parent_base", "ParentWithBase", sizeof(struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase)) __PYX_ERR(15, 11, __pyx_L1_error)
8756
__pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase = (struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase)) __PYX_ERR(15, 11, __pyx_L1_error)
8757
__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens = __Pyx_ImportType("sage.structure.parent_gens", "ParentWithGens", sizeof(struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens)) __PYX_ERR(16, 18, __pyx_L1_error)
8758
__pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens = (struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens)) __PYX_ERR(16, 18, __pyx_L1_error)
8759
__pyx_ptype_4sage_5rings_4ring_Ring = __Pyx_ImportType("sage.rings.ring", "Ring", sizeof(struct __pyx_obj_4sage_5rings_4ring_Ring), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_Ring)) __PYX_ERR(17, 5, __pyx_L1_error)
8760
__pyx_vtabptr_4sage_5rings_4ring_Ring = (struct __pyx_vtabstruct_4sage_5rings_4ring_Ring*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_Ring->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_Ring)) __PYX_ERR(17, 5, __pyx_L1_error)
8761
__pyx_ptype_4sage_5rings_4ring_CommutativeRing = __Pyx_ImportType("sage.rings.ring", "CommutativeRing", sizeof(struct __pyx_obj_4sage_5rings_4ring_CommutativeRing), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_CommutativeRing)) __PYX_ERR(17, 13, __pyx_L1_error)
8762
__pyx_vtabptr_4sage_5rings_4ring_CommutativeRing = (struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_CommutativeRing->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_CommutativeRing)) __PYX_ERR(17, 13, __pyx_L1_error)
8763
__pyx_ptype_4sage_5rings_4ring_IntegralDomain = __Pyx_ImportType("sage.rings.ring", "IntegralDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_IntegralDomain), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_IntegralDomain)) __PYX_ERR(17, 16, __pyx_L1_error)
8764
__pyx_vtabptr_4sage_5rings_4ring_IntegralDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_IntegralDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_IntegralDomain)) __PYX_ERR(17, 16, __pyx_L1_error)
8765
__pyx_ptype_4sage_5rings_4ring_DedekindDomain = __Pyx_ImportType("sage.rings.ring", "DedekindDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_DedekindDomain), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_DedekindDomain)) __PYX_ERR(17, 19, __pyx_L1_error)
8766
__pyx_vtabptr_4sage_5rings_4ring_DedekindDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_DedekindDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_DedekindDomain)) __PYX_ERR(17, 19, __pyx_L1_error)
8767
__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain = __Pyx_ImportType("sage.rings.ring", "PrincipalIdealDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain)) __PYX_ERR(17, 23, __pyx_L1_error)
8768
__pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain)) __PYX_ERR(17, 23, __pyx_L1_error)
8769
__pyx_ptype_4sage_5rings_4ring_EuclideanDomain = __Pyx_ImportType("sage.rings.ring", "EuclideanDomain", sizeof(struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_EuclideanDomain)) __PYX_ERR(17, 26, __pyx_L1_error)
8770
__pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain = (struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_EuclideanDomain->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain)) __PYX_ERR(17, 26, __pyx_L1_error)
8771
__pyx_ptype_4sage_5rings_4ring_Field = __Pyx_ImportType("sage.rings.ring", "Field", sizeof(struct __pyx_obj_4sage_5rings_4ring_Field), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_Field)) __PYX_ERR(17, 29, __pyx_L1_error)
8772
__pyx_vtabptr_4sage_5rings_4ring_Field = (struct __pyx_vtabstruct_4sage_5rings_4ring_Field*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_Field->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_Field)) __PYX_ERR(17, 29, __pyx_L1_error)
8773
__pyx_ptype_4sage_5rings_4ring_Algebra = __Pyx_ImportType("sage.rings.ring", "Algebra", sizeof(struct __pyx_obj_4sage_5rings_4ring_Algebra), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_Algebra)) __PYX_ERR(17, 32, __pyx_L1_error)
8774
__pyx_vtabptr_4sage_5rings_4ring_Algebra = (struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_Algebra->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_Algebra)) __PYX_ERR(17, 32, __pyx_L1_error)
8775
__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra = __Pyx_ImportType("sage.rings.ring", "CommutativeAlgebra", sizeof(struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra), 1); if (unlikely(!__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra)) __PYX_ERR(17, 35, __pyx_L1_error)
8776
__pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra = (struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra)) __PYX_ERR(17, 35, __pyx_L1_error)
8777
__pyx_ptype_4sage_4misc_11binary_tree_BinaryTree = __Pyx_ImportType("sage.misc.binary_tree", "BinaryTree", sizeof(struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree), 1); if (unlikely(!__pyx_ptype_4sage_4misc_11binary_tree_BinaryTree)) __PYX_ERR(18, 27, __pyx_L1_error)
8778
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "generic_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd)) __PYX_ERR(19, 5, __pyx_L1_error)
8779
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd)) __PYX_ERR(19, 5, __pyx_L1_error)
8780
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "CompiledPolynomialFunction", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction)) __PYX_ERR(19, 7, __pyx_L1_error)
8781
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction)) __PYX_ERR(19, 7, __pyx_L1_error)
8782
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "dummy_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd)) __PYX_ERR(19, 24, __pyx_L1_error)
8783
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd)) __PYX_ERR(19, 24, __pyx_L1_error)
8784
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "var_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd)) __PYX_ERR(19, 28, __pyx_L1_error)
8785
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd)) __PYX_ERR(19, 28, __pyx_L1_error)
8786
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "univar_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd)) __PYX_ERR(19, 31, __pyx_L1_error)
8787
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd)) __PYX_ERR(19, 31, __pyx_L1_error)
8788
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "coeff_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd)) __PYX_ERR(19, 34, __pyx_L1_error)
8789
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd)) __PYX_ERR(19, 34, __pyx_L1_error)
8790
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "unary_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd)) __PYX_ERR(19, 38, __pyx_L1_error)
8791
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd)) __PYX_ERR(19, 38, __pyx_L1_error)
8792
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "sqr_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd)) __PYX_ERR(19, 41, __pyx_L1_error)
8793
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd)) __PYX_ERR(19, 41, __pyx_L1_error)
8794
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "pow_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd)) __PYX_ERR(19, 44, __pyx_L1_error)
8795
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd)) __PYX_ERR(19, 44, __pyx_L1_error)
8796
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "binary_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd)) __PYX_ERR(19, 48, __pyx_L1_error)
8797
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd)) __PYX_ERR(19, 48, __pyx_L1_error)
8798
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "add_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd)) __PYX_ERR(19, 51, __pyx_L1_error)
8799
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd)) __PYX_ERR(19, 51, __pyx_L1_error)
8800
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "mul_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd)) __PYX_ERR(19, 54, __pyx_L1_error)
8801
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd)) __PYX_ERR(19, 54, __pyx_L1_error)
8802
__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = __Pyx_ImportType("sage.rings.polynomial.polynomial_compiled", "abc_pd", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd)) __PYX_ERR(19, 57, __pyx_L1_error)
8803
__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd)) __PYX_ERR(19, 57, __pyx_L1_error)
8804
__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial = __Pyx_ImportType("sage.rings.polynomial.polynomial_element", "Polynomial", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial)) __PYX_ERR(20, 8, __pyx_L1_error)
8805
__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial)) __PYX_ERR(20, 8, __pyx_L1_error)
8806
__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = __Pyx_ImportType("sage.rings.polynomial.polynomial_element", "Polynomial_generic_dense", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense)) __PYX_ERR(20, 29, __pyx_L1_error)
8807
__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense)) __PYX_ERR(20, 29, __pyx_L1_error)
8808
__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = __Pyx_ImportType("sage.rings.polynomial.polynomial_element", "Polynomial_generic_dense_inexact", sizeof(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact), 1); if (unlikely(!__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact)) __PYX_ERR(20, 34, __pyx_L1_error)
8809
__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = (struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact)) __PYX_ERR(20, 34, __pyx_L1_error)
8810
__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = __Pyx_ImportType("sage.libs.ntl.ntl_ZZX", "ntl_ZZX", sizeof(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX), 1); if (unlikely(!__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX)) __PYX_ERR(21, 3, __pyx_L1_error)
8811
__pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = (struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX*)__Pyx_GetVtable(__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX)) __PYX_ERR(21, 3, __pyx_L1_error)
8812
__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = __Pyx_ImportType("sage.libs.ntl.ntl_ZZ", "ntl_ZZ", sizeof(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ), 1); if (unlikely(!__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ)) __PYX_ERR(22, 3, __pyx_L1_error)
8813
__pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = (struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ*)__Pyx_GetVtable(__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ)) __PYX_ERR(22, 3, __pyx_L1_error)
8814
__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = __Pyx_ImportType("sage.rings.number_field.number_field_element", "NumberFieldElement", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement)) __PYX_ERR(23, 11, __pyx_L1_error)
8815
__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement)) __PYX_ERR(23, 11, __pyx_L1_error)
8816
__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = __Pyx_ImportType("sage.rings.number_field.number_field_element", "NumberFieldElement_absolute", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute)) __PYX_ERR(23, 38, __pyx_L1_error)
8817
__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute)) __PYX_ERR(23, 38, __pyx_L1_error)
8818
__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = __Pyx_ImportType("sage.rings.number_field.number_field_element", "NumberFieldElement_relative", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative)) __PYX_ERR(23, 41, __pyx_L1_error)
8819
__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative)) __PYX_ERR(23, 41, __pyx_L1_error)
8820
__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = __Pyx_ImportType("sage.rings.number_field.number_field_element", "OrderElement_absolute", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute)) __PYX_ERR(23, 46, __pyx_L1_error)
8821
__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute)) __PYX_ERR(23, 46, __pyx_L1_error)
8822
__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = __Pyx_ImportType("sage.rings.number_field.number_field_element", "OrderElement_relative", sizeof(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative)) __PYX_ERR(23, 49, __pyx_L1_error)
8823
__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = (struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative)) __PYX_ERR(23, 49, __pyx_L1_error)
8824
__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic = __Pyx_ImportType("sage.rings.number_field.number_field_element_quadratic", "NumberFieldElement_quadratic", sizeof(struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic)) __PYX_ERR(24, 6, __pyx_L1_error)
8825
__pyx_vtabptr_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic = (struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic)) __PYX_ERR(24, 6, __pyx_L1_error)
8826
__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic = __Pyx_ImportType("sage.rings.number_field.number_field_element_quadratic", "OrderElement_quadratic", sizeof(struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic), 1); if (unlikely(!__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic)) __PYX_ERR(24, 19, __pyx_L1_error)
8827
__pyx_vtabptr_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic = (struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic)) __PYX_ERR(24, 19, __pyx_L1_error)
8828
__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement = __Pyx_ImportType("psage.modform.hilbert.sqrt5.sqrt5_fast", "ResidueRingElement", sizeof(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement), 1); if (unlikely(!__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement)) __PYX_ERR(25, 7, __pyx_L1_error)
8829
__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement = (struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement*)__Pyx_GetVtable(__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement->tp_dict); if (unlikely(!__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement)) __PYX_ERR(25, 7, __pyx_L1_error)
8830
__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract = __Pyx_ImportType("psage.modform.hilbert.sqrt5.sqrt5_fast", "ResidueRing_abstract", sizeof(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract), 1); if (unlikely(!__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract)) __PYX_ERR(25, 9, __pyx_L1_error)
8831
__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract = (struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract*)__Pyx_GetVtable(__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract->tp_dict); if (unlikely(!__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract)) __PYX_ERR(25, 9, __pyx_L1_error)
8832
__pyx_ptype_5psage_13number_fields_5sqrt5_5prime_Prime = __Pyx_ImportType("psage.number_fields.sqrt5.prime", "Prime", sizeof(struct __pyx_obj_5psage_13number_fields_5sqrt5_5prime_Prime), 1); if (unlikely(!__pyx_ptype_5psage_13number_fields_5sqrt5_5prime_Prime)) __PYX_ERR(26, 22, __pyx_L1_error)
8833
__pyx_vtabptr_5psage_13number_fields_5sqrt5_5prime_Prime = (struct __pyx_vtabstruct_5psage_13number_fields_5sqrt5_5prime_Prime*)__Pyx_GetVtable(__pyx_ptype_5psage_13number_fields_5sqrt5_5prime_Prime->tp_dict); if (unlikely(!__pyx_vtabptr_5psage_13number_fields_5sqrt5_5prime_Prime)) __PYX_ERR(26, 22, __pyx_L1_error)
8834
/*--- Variable import code ---*/
8835
__pyx_t_1 = __Pyx_ImportModule("sage.structure.element"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
8836
if (__Pyx_ImportVoidPtr(__pyx_t_1, "coercion_model", (void **)&__pyx_vp_4sage_9structure_7element_coercion_model, "struct __pyx_obj_4sage_9structure_7element_CoercionModel *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8837
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8838
/*--- Function import code ---*/
8839
/*--- Execution code ---*/
8840
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
8841
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8842
#endif
8843
8844
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":47
8845
* from sage.rings.integer cimport Integer
8846
*
8847
* from psage.libs.smalljac.wrapper1 import elliptic_curve_ap # <<<<<<<<<<<<<<
8848
*
8849
* from psage.number_fields.sqrt5.prime import primes_of_bounded_norm
8850
*/
8851
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
8852
__Pyx_GOTREF(__pyx_t_2);
8853
__Pyx_INCREF(__pyx_n_s_elliptic_curve_ap);
8854
__Pyx_GIVEREF(__pyx_n_s_elliptic_curve_ap);
8855
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_elliptic_curve_ap);
8856
__pyx_t_3 = __Pyx_Import(__pyx_n_s_psage_libs_smalljac_wrapper1, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
8857
__Pyx_GOTREF(__pyx_t_3);
8858
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8859
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_elliptic_curve_ap); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
8860
__Pyx_GOTREF(__pyx_t_2);
8861
if (PyDict_SetItem(__pyx_d, __pyx_n_s_elliptic_curve_ap, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
8862
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8863
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8864
8865
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":49
8866
* from psage.libs.smalljac.wrapper1 import elliptic_curve_ap
8867
*
8868
* from psage.number_fields.sqrt5.prime import primes_of_bounded_norm # <<<<<<<<<<<<<<
8869
*
8870
* from psage.modform.hilbert.sqrt5.sqrt5_fast cimport ResidueRing_abstract, residue_element
8871
*/
8872
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
8873
__Pyx_GOTREF(__pyx_t_3);
8874
__Pyx_INCREF(__pyx_n_s_primes_of_bounded_norm);
8875
__Pyx_GIVEREF(__pyx_n_s_primes_of_bounded_norm);
8876
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_primes_of_bounded_norm);
8877
__pyx_t_2 = __Pyx_Import(__pyx_n_s_psage_number_fields_sqrt5_prime, __pyx_t_3, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
8878
__Pyx_GOTREF(__pyx_t_2);
8879
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8880
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_primes_of_bounded_norm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
8881
__Pyx_GOTREF(__pyx_t_3);
8882
if (PyDict_SetItem(__pyx_d, __pyx_n_s_primes_of_bounded_norm, __pyx_t_3) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
8883
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8884
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8885
8886
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":52
8887
*
8888
* from psage.modform.hilbert.sqrt5.sqrt5_fast cimport ResidueRing_abstract, residue_element
8889
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing # <<<<<<<<<<<<<<
8890
*
8891
* def short_weierstrass_invariants(E):
8892
*/
8893
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
8894
__Pyx_GOTREF(__pyx_t_2);
8895
__Pyx_INCREF(__pyx_n_s_ResidueRing);
8896
__Pyx_GIVEREF(__pyx_n_s_ResidueRing);
8897
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ResidueRing);
8898
__pyx_t_3 = __Pyx_Import(__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
8899
__Pyx_GOTREF(__pyx_t_3);
8900
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8901
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ResidueRing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
8902
__Pyx_GOTREF(__pyx_t_2);
8903
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ResidueRing, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
8904
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8905
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8906
8907
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":54
8908
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing
8909
*
8910
* def short_weierstrass_invariants(E): # <<<<<<<<<<<<<<
8911
* """
8912
* Compute the invariants of a short Weierstrass form of E.
8913
*/
8914
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_1short_weierstrass_invariants, NULL, __pyx_n_s_code_alex_psage_psage_ellcurve_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
8915
__Pyx_GOTREF(__pyx_t_3);
8916
if (PyDict_SetItem(__pyx_d, __pyx_n_s_short_weierstrass_invariants, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
8917
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8918
8919
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":93
8920
* return A, B
8921
*
8922
* def aplist(E, bound, fast_only=False): # <<<<<<<<<<<<<<
8923
* """
8924
* Compute the traces of Frobenius `a_P` of the elliptic curve E over Q(sqrt(5)) for
8925
*/
8926
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_3aplist, NULL, __pyx_n_s_code_alex_psage_psage_ellcurve_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
8927
__Pyx_GOTREF(__pyx_t_3);
8928
if (PyDict_SetItem(__pyx_d, __pyx_n_s_aplist, __pyx_t_3) < 0) __PYX_ERR(0, 93, __pyx_L1_error)
8929
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8930
8931
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":160
8932
* return v
8933
*
8934
* def aplist_remaining_slow(E, v, primes): # <<<<<<<<<<<<<<
8935
* """
8936
* Compute -- using possibly very slow methods -- the `a_P` in the
8937
*/
8938
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_5aplist_remaining_slow, NULL, __pyx_n_s_code_alex_psage_psage_ellcurve_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
8939
__Pyx_GOTREF(__pyx_t_3);
8940
if (PyDict_SetItem(__pyx_d, __pyx_n_s_aplist_remaining_slow, __pyx_t_3) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
8941
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8942
8943
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":218
8944
* v[i] = k.cardinality() + 1 - F.change_ring(k).cardinality()
8945
*
8946
* def aplist_short(A, B, primes): # <<<<<<<<<<<<<<
8947
* """
8948
* Return list of `a_P` values that can be quickly computed for the
8949
*/
8950
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_12aplist_sqrt5_7aplist_short, NULL, __pyx_n_s_code_alex_psage_psage_ellcurve_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
8951
__Pyx_GOTREF(__pyx_t_3);
8952
if (PyDict_SetItem(__pyx_d, __pyx_n_s_aplist_short, __pyx_t_3) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
8953
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8954
8955
/* "code/alex/psage/psage/ellcurve/lseries/aplist_sqrt5.pyx":1
8956
* ################################################################################# # <<<<<<<<<<<<<<
8957
* #
8958
* # (c) Copyright 2011 William Stein
8959
*/
8960
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
8961
__Pyx_GOTREF(__pyx_t_3);
8962
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8963
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8964
8965
/* "cfunc.to_py":64
8966
*
8967
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
8968
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
8969
* def wrap(object arg0, object arg1, int arg2):
8970
* """wrap(arg0, arg1, arg2: 'int')"""
8971
*/
8972
8973
/*--- Wrapped vars code ---*/
8974
8975
goto __pyx_L0;
8976
__pyx_L1_error:;
8977
__Pyx_XDECREF(__pyx_t_1);
8978
__Pyx_XDECREF(__pyx_t_2);
8979
__Pyx_XDECREF(__pyx_t_3);
8980
if (__pyx_m) {
8981
if (__pyx_d) {
8982
__Pyx_AddTraceback("init code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5", __pyx_clineno, __pyx_lineno, __pyx_filename);
8983
}
8984
Py_DECREF(__pyx_m); __pyx_m = 0;
8985
} else if (!PyErr_Occurred()) {
8986
PyErr_SetString(PyExc_ImportError, "init code.alex.psage.psage.ellcurve.lseries.aplist_sqrt5");
8987
}
8988
__pyx_L0:;
8989
__Pyx_RefNannyFinishContext();
8990
#if PY_MAJOR_VERSION < 3
8991
return;
8992
#else
8993
return __pyx_m;
8994
#endif
8995
}
8996
8997
/* --- Runtime support code --- */
8998
/* Refnanny */
8999
#if CYTHON_REFNANNY
9000
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
9001
PyObject *m = NULL, *p = NULL;
9002
void *r = NULL;
9003
m = PyImport_ImportModule((char *)modname);
9004
if (!m) goto end;
9005
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
9006
if (!p) goto end;
9007
r = PyLong_AsVoidPtr(p);
9008
end:
9009
Py_XDECREF(p);
9010
Py_XDECREF(m);
9011
return (__Pyx_RefNannyAPIStruct *)r;
9012
}
9013
#endif
9014
9015
/* GetBuiltinName */
9016
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
9017
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
9018
if (unlikely(!result)) {
9019
PyErr_Format(PyExc_NameError,
9020
#if PY_MAJOR_VERSION >= 3
9021
"name '%U' is not defined", name);
9022
#else
9023
"name '%.200s' is not defined", PyString_AS_STRING(name));
9024
#endif
9025
}
9026
return result;
9027
}
9028
9029
/* PyCFunctionFastCall */
9030
#if CYTHON_FAST_PYCCALL
9031
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
9032
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
9033
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
9034
PyObject *self = PyCFunction_GET_SELF(func);
9035
assert(PyCFunction_Check(func));
9036
assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
9037
assert(nargs >= 0);
9038
assert(nargs == 0 || args != NULL);
9039
/* _PyCFunction_FastCallDict() must not be called with an exception set,
9040
because it may clear it (directly or indirectly) and so the
9041
caller loses its exception */
9042
assert(!PyErr_Occurred());
9043
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
9044
}
9045
#endif // CYTHON_FAST_PYCCALL
9046
9047
/* PyFunctionFastCall */
9048
#if CYTHON_FAST_PYCALL
9049
#include "frameobject.h"
9050
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
9051
PyObject *globals) {
9052
PyFrameObject *f;
9053
PyThreadState *tstate = PyThreadState_GET();
9054
PyObject **fastlocals;
9055
Py_ssize_t i;
9056
PyObject *result;
9057
assert(globals != NULL);
9058
/* XXX Perhaps we should create a specialized
9059
PyFrame_New() that doesn't take locals, but does
9060
take builtins without sanity checking them.
9061
*/
9062
assert(tstate != NULL);
9063
f = PyFrame_New(tstate, co, globals, NULL);
9064
if (f == NULL) {
9065
return NULL;
9066
}
9067
fastlocals = f->f_localsplus;
9068
for (i = 0; i < na; i++) {
9069
Py_INCREF(*args);
9070
fastlocals[i] = *args++;
9071
}
9072
result = PyEval_EvalFrameEx(f,0);
9073
++tstate->recursion_depth;
9074
Py_DECREF(f);
9075
--tstate->recursion_depth;
9076
return result;
9077
}
9078
#if 1 || PY_VERSION_HEX < 0x030600B1
9079
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
9080
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
9081
PyObject *globals = PyFunction_GET_GLOBALS(func);
9082
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
9083
PyObject *closure;
9084
#if PY_MAJOR_VERSION >= 3
9085
PyObject *kwdefs;
9086
#endif
9087
PyObject *kwtuple, **k;
9088
PyObject **d;
9089
Py_ssize_t nd;
9090
Py_ssize_t nk;
9091
PyObject *result;
9092
assert(kwargs == NULL || PyDict_Check(kwargs));
9093
nk = kwargs ? PyDict_Size(kwargs) : 0;
9094
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
9095
return NULL;
9096
}
9097
if (
9098
#if PY_MAJOR_VERSION >= 3
9099
co->co_kwonlyargcount == 0 &&
9100
#endif
9101
likely(kwargs == NULL || nk == 0) &&
9102
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
9103
if (argdefs == NULL && co->co_argcount == nargs) {
9104
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
9105
goto done;
9106
}
9107
else if (nargs == 0 && argdefs != NULL
9108
&& co->co_argcount == Py_SIZE(argdefs)) {
9109
/* function called with no arguments, but all parameters have
9110
a default value: use default values as arguments .*/
9111
args = &PyTuple_GET_ITEM(argdefs, 0);
9112
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
9113
goto done;
9114
}
9115
}
9116
if (kwargs != NULL) {
9117
Py_ssize_t pos, i;
9118
kwtuple = PyTuple_New(2 * nk);
9119
if (kwtuple == NULL) {
9120
result = NULL;
9121
goto done;
9122
}
9123
k = &PyTuple_GET_ITEM(kwtuple, 0);
9124
pos = i = 0;
9125
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
9126
Py_INCREF(k[i]);
9127
Py_INCREF(k[i+1]);
9128
i += 2;
9129
}
9130
nk = i / 2;
9131
}
9132
else {
9133
kwtuple = NULL;
9134
k = NULL;
9135
}
9136
closure = PyFunction_GET_CLOSURE(func);
9137
#if PY_MAJOR_VERSION >= 3
9138
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
9139
#endif
9140
if (argdefs != NULL) {
9141
d = &PyTuple_GET_ITEM(argdefs, 0);
9142
nd = Py_SIZE(argdefs);
9143
}
9144
else {
9145
d = NULL;
9146
nd = 0;
9147
}
9148
#if PY_MAJOR_VERSION >= 3
9149
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
9150
args, nargs,
9151
k, (int)nk,
9152
d, (int)nd, kwdefs, closure);
9153
#else
9154
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
9155
args, nargs,
9156
k, (int)nk,
9157
d, (int)nd, closure);
9158
#endif
9159
Py_XDECREF(kwtuple);
9160
done:
9161
Py_LeaveRecursiveCall();
9162
return result;
9163
}
9164
#endif // CPython < 3.6
9165
#endif // CYTHON_FAST_PYCALL
9166
9167
/* PyObjectCall */
9168
#if CYTHON_COMPILING_IN_CPYTHON
9169
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
9170
PyObject *result;
9171
ternaryfunc call = func->ob_type->tp_call;
9172
if (unlikely(!call))
9173
return PyObject_Call(func, arg, kw);
9174
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
9175
return NULL;
9176
result = (*call)(func, arg, kw);
9177
Py_LeaveRecursiveCall();
9178
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
9179
PyErr_SetString(
9180
PyExc_SystemError,
9181
"NULL result without error in PyObject_Call");
9182
}
9183
return result;
9184
}
9185
#endif
9186
9187
/* PyObjectCallMethO */
9188
#if CYTHON_COMPILING_IN_CPYTHON
9189
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
9190
PyObject *self, *result;
9191
PyCFunction cfunc;
9192
cfunc = PyCFunction_GET_FUNCTION(func);
9193
self = PyCFunction_GET_SELF(func);
9194
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
9195
return NULL;
9196
result = cfunc(self, arg);
9197
Py_LeaveRecursiveCall();
9198
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
9199
PyErr_SetString(
9200
PyExc_SystemError,
9201
"NULL result without error in PyObject_Call");
9202
}
9203
return result;
9204
}
9205
#endif
9206
9207
/* PyObjectCallOneArg */
9208
#if CYTHON_COMPILING_IN_CPYTHON
9209
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9210
PyObject *result;
9211
PyObject *args = PyTuple_New(1);
9212
if (unlikely(!args)) return NULL;
9213
Py_INCREF(arg);
9214
PyTuple_SET_ITEM(args, 0, arg);
9215
result = __Pyx_PyObject_Call(func, args, NULL);
9216
Py_DECREF(args);
9217
return result;
9218
}
9219
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9220
#if CYTHON_FAST_PYCALL
9221
if (PyFunction_Check(func)) {
9222
return __Pyx_PyFunction_FastCall(func, &arg, 1);
9223
}
9224
#endif
9225
#ifdef __Pyx_CyFunction_USED
9226
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
9227
#else
9228
if (likely(PyCFunction_Check(func))) {
9229
#endif
9230
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
9231
return __Pyx_PyObject_CallMethO(func, arg);
9232
#if CYTHON_FAST_PYCCALL
9233
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
9234
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
9235
#endif
9236
}
9237
}
9238
return __Pyx__PyObject_CallOneArg(func, arg);
9239
}
9240
#else
9241
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9242
PyObject *result;
9243
PyObject *args = PyTuple_Pack(1, arg);
9244
if (unlikely(!args)) return NULL;
9245
result = __Pyx_PyObject_Call(func, args, NULL);
9246
Py_DECREF(args);
9247
return result;
9248
}
9249
#endif
9250
9251
/* PyObjectCallNoArg */
9252
#if CYTHON_COMPILING_IN_CPYTHON
9253
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
9254
#if CYTHON_FAST_PYCALL
9255
if (PyFunction_Check(func)) {
9256
return __Pyx_PyFunction_FastCall(func, NULL, 0);
9257
}
9258
#endif
9259
#ifdef __Pyx_CyFunction_USED
9260
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
9261
#else
9262
if (likely(PyCFunction_Check(func))) {
9263
#endif
9264
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
9265
return __Pyx_PyObject_CallMethO(func, NULL);
9266
}
9267
}
9268
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
9269
}
9270
#endif
9271
9272
/* RaiseTooManyValuesToUnpack */
9273
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
9274
PyErr_Format(PyExc_ValueError,
9275
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
9276
}
9277
9278
/* RaiseNeedMoreValuesToUnpack */
9279
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
9280
PyErr_Format(PyExc_ValueError,
9281
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
9282
index, (index == 1) ? "" : "s");
9283
}
9284
9285
/* IterFinish */
9286
static CYTHON_INLINE int __Pyx_IterFinish(void) {
9287
#if CYTHON_FAST_THREAD_STATE
9288
PyThreadState *tstate = PyThreadState_GET();
9289
PyObject* exc_type = tstate->curexc_type;
9290
if (unlikely(exc_type)) {
9291
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
9292
PyObject *exc_value, *exc_tb;
9293
exc_value = tstate->curexc_value;
9294
exc_tb = tstate->curexc_traceback;
9295
tstate->curexc_type = 0;
9296
tstate->curexc_value = 0;
9297
tstate->curexc_traceback = 0;
9298
Py_DECREF(exc_type);
9299
Py_XDECREF(exc_value);
9300
Py_XDECREF(exc_tb);
9301
return 0;
9302
} else {
9303
return -1;
9304
}
9305
}
9306
return 0;
9307
#else
9308
if (unlikely(PyErr_Occurred())) {
9309
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
9310
PyErr_Clear();
9311
return 0;
9312
} else {
9313
return -1;
9314
}
9315
}
9316
return 0;
9317
#endif
9318
}
9319
9320
/* UnpackItemEndCheck */
9321
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
9322
if (unlikely(retval)) {
9323
Py_DECREF(retval);
9324
__Pyx_RaiseTooManyValuesError(expected);
9325
return -1;
9326
} else {
9327
return __Pyx_IterFinish();
9328
}
9329
return 0;
9330
}
9331
9332
/* RaiseArgTupleInvalid */
9333
static void __Pyx_RaiseArgtupleInvalid(
9334
const char* func_name,
9335
int exact,
9336
Py_ssize_t num_min,
9337
Py_ssize_t num_max,
9338
Py_ssize_t num_found)
9339
{
9340
Py_ssize_t num_expected;
9341
const char *more_or_less;
9342
if (num_found < num_min) {
9343
num_expected = num_min;
9344
more_or_less = "at least";
9345
} else {
9346
num_expected = num_max;
9347
more_or_less = "at most";
9348
}
9349
if (exact) {
9350
more_or_less = "exactly";
9351
}
9352
PyErr_Format(PyExc_TypeError,
9353
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
9354
func_name, more_or_less, num_expected,
9355
(num_expected == 1) ? "" : "s", num_found);
9356
}
9357
9358
/* RaiseDoubleKeywords */
9359
static void __Pyx_RaiseDoubleKeywordsError(
9360
const char* func_name,
9361
PyObject* kw_name)
9362
{
9363
PyErr_Format(PyExc_TypeError,
9364
#if PY_MAJOR_VERSION >= 3
9365
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
9366
#else
9367
"%s() got multiple values for keyword argument '%s'", func_name,
9368
PyString_AsString(kw_name));
9369
#endif
9370
}
9371
9372
/* ParseKeywords */
9373
static int __Pyx_ParseOptionalKeywords(
9374
PyObject *kwds,
9375
PyObject **argnames[],
9376
PyObject *kwds2,
9377
PyObject *values[],
9378
Py_ssize_t num_pos_args,
9379
const char* function_name)
9380
{
9381
PyObject *key = 0, *value = 0;
9382
Py_ssize_t pos = 0;
9383
PyObject*** name;
9384
PyObject*** first_kw_arg = argnames + num_pos_args;
9385
while (PyDict_Next(kwds, &pos, &key, &value)) {
9386
name = first_kw_arg;
9387
while (*name && (**name != key)) name++;
9388
if (*name) {
9389
values[name-argnames] = value;
9390
continue;
9391
}
9392
name = first_kw_arg;
9393
#if PY_MAJOR_VERSION < 3
9394
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
9395
while (*name) {
9396
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
9397
&& _PyString_Eq(**name, key)) {
9398
values[name-argnames] = value;
9399
break;
9400
}
9401
name++;
9402
}
9403
if (*name) continue;
9404
else {
9405
PyObject*** argname = argnames;
9406
while (argname != first_kw_arg) {
9407
if ((**argname == key) || (
9408
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
9409
&& _PyString_Eq(**argname, key))) {
9410
goto arg_passed_twice;
9411
}
9412
argname++;
9413
}
9414
}
9415
} else
9416
#endif
9417
if (likely(PyUnicode_Check(key))) {
9418
while (*name) {
9419
int cmp = (**name == key) ? 0 :
9420
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
9421
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
9422
#endif
9423
PyUnicode_Compare(**name, key);
9424
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
9425
if (cmp == 0) {
9426
values[name-argnames] = value;
9427
break;
9428
}
9429
name++;
9430
}
9431
if (*name) continue;
9432
else {
9433
PyObject*** argname = argnames;
9434
while (argname != first_kw_arg) {
9435
int cmp = (**argname == key) ? 0 :
9436
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
9437
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
9438
#endif
9439
PyUnicode_Compare(**argname, key);
9440
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
9441
if (cmp == 0) goto arg_passed_twice;
9442
argname++;
9443
}
9444
}
9445
} else
9446
goto invalid_keyword_type;
9447
if (kwds2) {
9448
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
9449
} else {
9450
goto invalid_keyword;
9451
}
9452
}
9453
return 0;
9454
arg_passed_twice:
9455
__Pyx_RaiseDoubleKeywordsError(function_name, key);
9456
goto bad;
9457
invalid_keyword_type:
9458
PyErr_Format(PyExc_TypeError,
9459
"%.200s() keywords must be strings", function_name);
9460
goto bad;
9461
invalid_keyword:
9462
PyErr_Format(PyExc_TypeError,
9463
#if PY_MAJOR_VERSION < 3
9464
"%.200s() got an unexpected keyword argument '%.200s'",
9465
function_name, PyString_AsString(key));
9466
#else
9467
"%s() got an unexpected keyword argument '%U'",
9468
function_name, key);
9469
#endif
9470
bad:
9471
return -1;
9472
}
9473
9474
/* PyErrFetchRestore */
9475
#if CYTHON_FAST_THREAD_STATE
9476
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
9477
PyObject *tmp_type, *tmp_value, *tmp_tb;
9478
tmp_type = tstate->curexc_type;
9479
tmp_value = tstate->curexc_value;
9480
tmp_tb = tstate->curexc_traceback;
9481
tstate->curexc_type = type;
9482
tstate->curexc_value = value;
9483
tstate->curexc_traceback = tb;
9484
Py_XDECREF(tmp_type);
9485
Py_XDECREF(tmp_value);
9486
Py_XDECREF(tmp_tb);
9487
}
9488
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9489
*type = tstate->curexc_type;
9490
*value = tstate->curexc_value;
9491
*tb = tstate->curexc_traceback;
9492
tstate->curexc_type = 0;
9493
tstate->curexc_value = 0;
9494
tstate->curexc_traceback = 0;
9495
}
9496
#endif
9497
9498
/* RaiseException */
9499
#if PY_MAJOR_VERSION < 3
9500
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
9501
CYTHON_UNUSED PyObject *cause) {
9502
__Pyx_PyThreadState_declare
9503
Py_XINCREF(type);
9504
if (!value || value == Py_None)
9505
value = NULL;
9506
else
9507
Py_INCREF(value);
9508
if (!tb || tb == Py_None)
9509
tb = NULL;
9510
else {
9511
Py_INCREF(tb);
9512
if (!PyTraceBack_Check(tb)) {
9513
PyErr_SetString(PyExc_TypeError,
9514
"raise: arg 3 must be a traceback or None");
9515
goto raise_error;
9516
}
9517
}
9518
if (PyType_Check(type)) {
9519
#if CYTHON_COMPILING_IN_PYPY
9520
if (!value) {
9521
Py_INCREF(Py_None);
9522
value = Py_None;
9523
}
9524
#endif
9525
PyErr_NormalizeException(&type, &value, &tb);
9526
} else {
9527
if (value) {
9528
PyErr_SetString(PyExc_TypeError,
9529
"instance exception may not have a separate value");
9530
goto raise_error;
9531
}
9532
value = type;
9533
type = (PyObject*) Py_TYPE(type);
9534
Py_INCREF(type);
9535
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
9536
PyErr_SetString(PyExc_TypeError,
9537
"raise: exception class must be a subclass of BaseException");
9538
goto raise_error;
9539
}
9540
}
9541
__Pyx_PyThreadState_assign
9542
__Pyx_ErrRestore(type, value, tb);
9543
return;
9544
raise_error:
9545
Py_XDECREF(value);
9546
Py_XDECREF(type);
9547
Py_XDECREF(tb);
9548
return;
9549
}
9550
#else
9551
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
9552
PyObject* owned_instance = NULL;
9553
if (tb == Py_None) {
9554
tb = 0;
9555
} else if (tb && !PyTraceBack_Check(tb)) {
9556
PyErr_SetString(PyExc_TypeError,
9557
"raise: arg 3 must be a traceback or None");
9558
goto bad;
9559
}
9560
if (value == Py_None)
9561
value = 0;
9562
if (PyExceptionInstance_Check(type)) {
9563
if (value) {
9564
PyErr_SetString(PyExc_TypeError,
9565
"instance exception may not have a separate value");
9566
goto bad;
9567
}
9568
value = type;
9569
type = (PyObject*) Py_TYPE(value);
9570
} else if (PyExceptionClass_Check(type)) {
9571
PyObject *instance_class = NULL;
9572
if (value && PyExceptionInstance_Check(value)) {
9573
instance_class = (PyObject*) Py_TYPE(value);
9574
if (instance_class != type) {
9575
int is_subclass = PyObject_IsSubclass(instance_class, type);
9576
if (!is_subclass) {
9577
instance_class = NULL;
9578
} else if (unlikely(is_subclass == -1)) {
9579
goto bad;
9580
} else {
9581
type = instance_class;
9582
}
9583
}
9584
}
9585
if (!instance_class) {
9586
PyObject *args;
9587
if (!value)
9588
args = PyTuple_New(0);
9589
else if (PyTuple_Check(value)) {
9590
Py_INCREF(value);
9591
args = value;
9592
} else
9593
args = PyTuple_Pack(1, value);
9594
if (!args)
9595
goto bad;
9596
owned_instance = PyObject_Call(type, args, NULL);
9597
Py_DECREF(args);
9598
if (!owned_instance)
9599
goto bad;
9600
value = owned_instance;
9601
if (!PyExceptionInstance_Check(value)) {
9602
PyErr_Format(PyExc_TypeError,
9603
"calling %R should have returned an instance of "
9604
"BaseException, not %R",
9605
type, Py_TYPE(value));
9606
goto bad;
9607
}
9608
}
9609
} else {
9610
PyErr_SetString(PyExc_TypeError,
9611
"raise: exception class must be a subclass of BaseException");
9612
goto bad;
9613
}
9614
#if PY_VERSION_HEX >= 0x03030000
9615
if (cause) {
9616
#else
9617
if (cause && cause != Py_None) {
9618
#endif
9619
PyObject *fixed_cause;
9620
if (cause == Py_None) {
9621
fixed_cause = NULL;
9622
} else if (PyExceptionClass_Check(cause)) {
9623
fixed_cause = PyObject_CallObject(cause, NULL);
9624
if (fixed_cause == NULL)
9625
goto bad;
9626
} else if (PyExceptionInstance_Check(cause)) {
9627
fixed_cause = cause;
9628
Py_INCREF(fixed_cause);
9629
} else {
9630
PyErr_SetString(PyExc_TypeError,
9631
"exception causes must derive from "
9632
"BaseException");
9633
goto bad;
9634
}
9635
PyException_SetCause(value, fixed_cause);
9636
}
9637
PyErr_SetObject(type, value);
9638
if (tb) {
9639
#if CYTHON_COMPILING_IN_PYPY
9640
PyObject *tmp_type, *tmp_value, *tmp_tb;
9641
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
9642
Py_INCREF(tb);
9643
PyErr_Restore(tmp_type, tmp_value, tb);
9644
Py_XDECREF(tmp_tb);
9645
#else
9646
PyThreadState *tstate = PyThreadState_GET();
9647
PyObject* tmp_tb = tstate->curexc_traceback;
9648
if (tb != tmp_tb) {
9649
Py_INCREF(tb);
9650
tstate->curexc_traceback = tb;
9651
Py_XDECREF(tmp_tb);
9652
}
9653
#endif
9654
}
9655
bad:
9656
Py_XDECREF(owned_instance);
9657
return;
9658
}
9659
#endif
9660
9661
/* GetModuleGlobalName */
9662
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
9663
PyObject *result;
9664
#if !CYTHON_AVOID_BORROWED_REFS
9665
result = PyDict_GetItem(__pyx_d, name);
9666
if (likely(result)) {
9667
Py_INCREF(result);
9668
} else {
9669
#else
9670
result = PyObject_GetItem(__pyx_d, name);
9671
if (!result) {
9672
PyErr_Clear();
9673
#endif
9674
result = __Pyx_GetBuiltinName(name);
9675
}
9676
return result;
9677
}
9678
9679
/* GetItemInt */
9680
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
9681
PyObject *r;
9682
if (!j) return NULL;
9683
r = PyObject_GetItem(o, j);
9684
Py_DECREF(j);
9685
return r;
9686
}
9687
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
9688
CYTHON_NCP_UNUSED int wraparound,
9689
CYTHON_NCP_UNUSED int boundscheck) {
9690
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9691
if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
9692
if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
9693
PyObject *r = PyList_GET_ITEM(o, i);
9694
Py_INCREF(r);
9695
return r;
9696
}
9697
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
9698
#else
9699
return PySequence_GetItem(o, i);
9700
#endif
9701
}
9702
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
9703
CYTHON_NCP_UNUSED int wraparound,
9704
CYTHON_NCP_UNUSED int boundscheck) {
9705
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9706
if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
9707
if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
9708
PyObject *r = PyTuple_GET_ITEM(o, i);
9709
Py_INCREF(r);
9710
return r;
9711
}
9712
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
9713
#else
9714
return PySequence_GetItem(o, i);
9715
#endif
9716
}
9717
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
9718
CYTHON_NCP_UNUSED int wraparound,
9719
CYTHON_NCP_UNUSED int boundscheck) {
9720
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
9721
if (is_list || PyList_CheckExact(o)) {
9722
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
9723
if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
9724
PyObject *r = PyList_GET_ITEM(o, n);
9725
Py_INCREF(r);
9726
return r;
9727
}
9728
}
9729
else if (PyTuple_CheckExact(o)) {
9730
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
9731
if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
9732
PyObject *r = PyTuple_GET_ITEM(o, n);
9733
Py_INCREF(r);
9734
return r;
9735
}
9736
} else {
9737
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
9738
if (likely(m && m->sq_item)) {
9739
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
9740
Py_ssize_t l = m->sq_length(o);
9741
if (likely(l >= 0)) {
9742
i += l;
9743
} else {
9744
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
9745
return NULL;
9746
PyErr_Clear();
9747
}
9748
}
9749
return m->sq_item(o, i);
9750
}
9751
}
9752
#else
9753
if (is_list || PySequence_Check(o)) {
9754
return PySequence_GetItem(o, i);
9755
}
9756
#endif
9757
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
9758
}
9759
9760
/* SetItemInt */
9761
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
9762
int r;
9763
if (!j) return -1;
9764
r = PyObject_SetItem(o, j, v);
9765
Py_DECREF(j);
9766
return r;
9767
}
9768
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
9769
CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
9770
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
9771
if (is_list || PyList_CheckExact(o)) {
9772
Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
9773
if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
9774
PyObject* old = PyList_GET_ITEM(o, n);
9775
Py_INCREF(v);
9776
PyList_SET_ITEM(o, n, v);
9777
Py_DECREF(old);
9778
return 1;
9779
}
9780
} else {
9781
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
9782
if (likely(m && m->sq_ass_item)) {
9783
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
9784
Py_ssize_t l = m->sq_length(o);
9785
if (likely(l >= 0)) {
9786
i += l;
9787
} else {
9788
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
9789
return -1;
9790
PyErr_Clear();
9791
}
9792
}
9793
return m->sq_ass_item(o, i, v);
9794
}
9795
}
9796
#else
9797
#if CYTHON_COMPILING_IN_PYPY
9798
if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
9799
#else
9800
if (is_list || PySequence_Check(o)) {
9801
#endif
9802
return PySequence_SetItem(o, i, v);
9803
}
9804
#endif
9805
return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
9806
}
9807
9808
/* PyIntBinop */
9809
#if !CYTHON_COMPILING_IN_PYPY
9810
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
9811
if (op1 == op2) {
9812
Py_RETURN_TRUE;
9813
}
9814
#if PY_MAJOR_VERSION < 3
9815
if (likely(PyInt_CheckExact(op1))) {
9816
const long b = intval;
9817
long a = PyInt_AS_LONG(op1);
9818
if (a == b) {
9819
Py_RETURN_TRUE;
9820
} else {
9821
Py_RETURN_FALSE;
9822
}
9823
}
9824
#endif
9825
#if CYTHON_USE_PYLONG_INTERNALS
9826
if (likely(PyLong_CheckExact(op1))) {
9827
const long b = intval;
9828
long a;
9829
const digit* digits = ((PyLongObject*)op1)->ob_digit;
9830
const Py_ssize_t size = Py_SIZE(op1);
9831
if (likely(__Pyx_sst_abs(size) <= 1)) {
9832
a = likely(size) ? digits[0] : 0;
9833
if (size == -1) a = -a;
9834
} else {
9835
switch (size) {
9836
case -2:
9837
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9838
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9839
break;
9840
}
9841
case 2:
9842
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9843
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9844
break;
9845
}
9846
case -3:
9847
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9848
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9849
break;
9850
}
9851
case 3:
9852
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9853
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9854
break;
9855
}
9856
case -4:
9857
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9858
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9859
break;
9860
}
9861
case 4:
9862
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9863
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9864
break;
9865
}
9866
#if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
9867
default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
9868
#else
9869
default: Py_RETURN_FALSE;
9870
#endif
9871
}
9872
}
9873
if (a == b) {
9874
Py_RETURN_TRUE;
9875
} else {
9876
Py_RETURN_FALSE;
9877
}
9878
}
9879
#endif
9880
if (PyFloat_CheckExact(op1)) {
9881
const long b = intval;
9882
double a = PyFloat_AS_DOUBLE(op1);
9883
if ((double)a == (double)b) {
9884
Py_RETURN_TRUE;
9885
} else {
9886
Py_RETURN_FALSE;
9887
}
9888
}
9889
return PyObject_RichCompare(op1, op2, Py_EQ);
9890
}
9891
#endif
9892
9893
/* PyIntBinop */
9894
#if !CYTHON_COMPILING_IN_PYPY
9895
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
9896
#if PY_MAJOR_VERSION < 3
9897
if (likely(PyInt_CheckExact(op1))) {
9898
const long b = intval;
9899
long x;
9900
long a = PyInt_AS_LONG(op1);
9901
x = (long)((unsigned long)a + b);
9902
if (likely((x^a) >= 0 || (x^b) >= 0))
9903
return PyInt_FromLong(x);
9904
return PyLong_Type.tp_as_number->nb_add(op1, op2);
9905
}
9906
#endif
9907
#if CYTHON_USE_PYLONG_INTERNALS
9908
if (likely(PyLong_CheckExact(op1))) {
9909
const long b = intval;
9910
long a, x;
9911
#ifdef HAVE_LONG_LONG
9912
const PY_LONG_LONG llb = intval;
9913
PY_LONG_LONG lla, llx;
9914
#endif
9915
const digit* digits = ((PyLongObject*)op1)->ob_digit;
9916
const Py_ssize_t size = Py_SIZE(op1);
9917
if (likely(__Pyx_sst_abs(size) <= 1)) {
9918
a = likely(size) ? digits[0] : 0;
9919
if (size == -1) a = -a;
9920
} else {
9921
switch (size) {
9922
case -2:
9923
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9924
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9925
break;
9926
#ifdef HAVE_LONG_LONG
9927
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
9928
lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9929
goto long_long;
9930
#endif
9931
}
9932
case 2:
9933
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9934
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9935
break;
9936
#ifdef HAVE_LONG_LONG
9937
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
9938
lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
9939
goto long_long;
9940
#endif
9941
}
9942
case -3:
9943
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9944
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9945
break;
9946
#ifdef HAVE_LONG_LONG
9947
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
9948
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]));
9949
goto long_long;
9950
#endif
9951
}
9952
case 3:
9953
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9954
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9955
break;
9956
#ifdef HAVE_LONG_LONG
9957
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
9958
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]));
9959
goto long_long;
9960
#endif
9961
}
9962
case -4:
9963
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9964
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9965
break;
9966
#ifdef HAVE_LONG_LONG
9967
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
9968
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]));
9969
goto long_long;
9970
#endif
9971
}
9972
case 4:
9973
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9974
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
9975
break;
9976
#ifdef HAVE_LONG_LONG
9977
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
9978
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]));
9979
goto long_long;
9980
#endif
9981
}
9982
default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
9983
}
9984
}
9985
x = a + b;
9986
return PyLong_FromLong(x);
9987
#ifdef HAVE_LONG_LONG
9988
long_long:
9989
llx = lla + llb;
9990
return PyLong_FromLongLong(llx);
9991
#endif
9992
9993
9994
}
9995
#endif
9996
if (PyFloat_CheckExact(op1)) {
9997
const long b = intval;
9998
double a = PyFloat_AS_DOUBLE(op1);
9999
double result;
10000
PyFPE_START_PROTECT("add", return NULL)
10001
result = ((double)a) + (double)b;
10002
PyFPE_END_PROTECT(result)
10003
return PyFloat_FromDouble(result);
10004
}
10005
return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
10006
}
10007
#endif
10008
10009
/* SaveResetException */
10010
#if CYTHON_FAST_THREAD_STATE
10011
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
10012
*type = tstate->exc_type;
10013
*value = tstate->exc_value;
10014
*tb = tstate->exc_traceback;
10015
Py_XINCREF(*type);
10016
Py_XINCREF(*value);
10017
Py_XINCREF(*tb);
10018
}
10019
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
10020
PyObject *tmp_type, *tmp_value, *tmp_tb;
10021
tmp_type = tstate->exc_type;
10022
tmp_value = tstate->exc_value;
10023
tmp_tb = tstate->exc_traceback;
10024
tstate->exc_type = type;
10025
tstate->exc_value = value;
10026
tstate->exc_traceback = tb;
10027
Py_XDECREF(tmp_type);
10028
Py_XDECREF(tmp_value);
10029
Py_XDECREF(tmp_tb);
10030
}
10031
#endif
10032
10033
/* PyErrExceptionMatches */
10034
#if CYTHON_FAST_THREAD_STATE
10035
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
10036
PyObject *exc_type = tstate->curexc_type;
10037
if (exc_type == err) return 1;
10038
if (unlikely(!exc_type)) return 0;
10039
return PyErr_GivenExceptionMatches(exc_type, err);
10040
}
10041
#endif
10042
10043
/* GetException */
10044
#if CYTHON_FAST_THREAD_STATE
10045
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
10046
#else
10047
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
10048
#endif
10049
PyObject *local_type, *local_value, *local_tb;
10050
#if CYTHON_FAST_THREAD_STATE
10051
PyObject *tmp_type, *tmp_value, *tmp_tb;
10052
local_type = tstate->curexc_type;
10053
local_value = tstate->curexc_value;
10054
local_tb = tstate->curexc_traceback;
10055
tstate->curexc_type = 0;
10056
tstate->curexc_value = 0;
10057
tstate->curexc_traceback = 0;
10058
#else
10059
PyErr_Fetch(&local_type, &local_value, &local_tb);
10060
#endif
10061
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
10062
#if CYTHON_FAST_THREAD_STATE
10063
if (unlikely(tstate->curexc_type))
10064
#else
10065
if (unlikely(PyErr_Occurred()))
10066
#endif
10067
goto bad;
10068
#if PY_MAJOR_VERSION >= 3
10069
if (local_tb) {
10070
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
10071
goto bad;
10072
}
10073
#endif
10074
Py_XINCREF(local_tb);
10075
Py_XINCREF(local_type);
10076
Py_XINCREF(local_value);
10077
*type = local_type;
10078
*value = local_value;
10079
*tb = local_tb;
10080
#if CYTHON_FAST_THREAD_STATE
10081
tmp_type = tstate->exc_type;
10082
tmp_value = tstate->exc_value;
10083
tmp_tb = tstate->exc_traceback;
10084
tstate->exc_type = local_type;
10085
tstate->exc_value = local_value;
10086
tstate->exc_traceback = local_tb;
10087
Py_XDECREF(tmp_type);
10088
Py_XDECREF(tmp_value);
10089
Py_XDECREF(tmp_tb);
10090
#else
10091
PyErr_SetExcInfo(local_type, local_value, local_tb);
10092
#endif
10093
return 0;
10094
bad:
10095
*type = 0;
10096
*value = 0;
10097
*tb = 0;
10098
Py_XDECREF(local_type);
10099
Py_XDECREF(local_value);
10100
Py_XDECREF(local_tb);
10101
return -1;
10102
}
10103
10104
/* None */
10105
static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
10106
long r = a % b;
10107
r += ((r != 0) & ((r ^ b) < 0)) * b;
10108
return r;
10109
}
10110
10111
/* Import */
10112
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
10113
PyObject *empty_list = 0;
10114
PyObject *module = 0;
10115
PyObject *global_dict = 0;
10116
PyObject *empty_dict = 0;
10117
PyObject *list;
10118
#if PY_VERSION_HEX < 0x03030000
10119
PyObject *py_import;
10120
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
10121
if (!py_import)
10122
goto bad;
10123
#endif
10124
if (from_list)
10125
list = from_list;
10126
else {
10127
empty_list = PyList_New(0);
10128
if (!empty_list)
10129
goto bad;
10130
list = empty_list;
10131
}
10132
global_dict = PyModule_GetDict(__pyx_m);
10133
if (!global_dict)
10134
goto bad;
10135
empty_dict = PyDict_New();
10136
if (!empty_dict)
10137
goto bad;
10138
{
10139
#if PY_MAJOR_VERSION >= 3
10140
if (level == -1) {
10141
if (strchr(__Pyx_MODULE_NAME, '.')) {
10142
#if PY_VERSION_HEX < 0x03030000
10143
PyObject *py_level = PyInt_FromLong(1);
10144
if (!py_level)
10145
goto bad;
10146
module = PyObject_CallFunctionObjArgs(py_import,
10147
name, global_dict, empty_dict, list, py_level, NULL);
10148
Py_DECREF(py_level);
10149
#else
10150
module = PyImport_ImportModuleLevelObject(
10151
name, global_dict, empty_dict, list, 1);
10152
#endif
10153
if (!module) {
10154
if (!PyErr_ExceptionMatches(PyExc_ImportError))
10155
goto bad;
10156
PyErr_Clear();
10157
}
10158
}
10159
level = 0;
10160
}
10161
#endif
10162
if (!module) {
10163
#if PY_VERSION_HEX < 0x03030000
10164
PyObject *py_level = PyInt_FromLong(level);
10165
if (!py_level)
10166
goto bad;
10167
module = PyObject_CallFunctionObjArgs(py_import,
10168
name, global_dict, empty_dict, list, py_level, NULL);
10169
Py_DECREF(py_level);
10170
#else
10171
module = PyImport_ImportModuleLevelObject(
10172
name, global_dict, empty_dict, list, level);
10173
#endif
10174
}
10175
}
10176
bad:
10177
#if PY_VERSION_HEX < 0x03030000
10178
Py_XDECREF(py_import);
10179
#endif
10180
Py_XDECREF(empty_list);
10181
Py_XDECREF(empty_dict);
10182
return module;
10183
}
10184
10185
/* ImportFrom */
10186
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
10187
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
10188
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
10189
PyErr_Format(PyExc_ImportError,
10190
#if PY_MAJOR_VERSION < 3
10191
"cannot import name %.230s", PyString_AS_STRING(name));
10192
#else
10193
"cannot import name %S", name);
10194
#endif
10195
}
10196
return value;
10197
}
10198
10199
/* ExtTypeTest */
10200
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
10201
if (unlikely(!type)) {
10202
PyErr_SetString(PyExc_SystemError, "Missing type object");
10203
return 0;
10204
}
10205
if (likely(PyObject_TypeCheck(obj, type)))
10206
return 1;
10207
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
10208
Py_TYPE(obj)->tp_name, type->tp_name);
10209
return 0;
10210
}
10211
10212
/* FetchCommonType */
10213
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
10214
PyObject* fake_module;
10215
PyTypeObject* cached_type = NULL;
10216
fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
10217
if (!fake_module) return NULL;
10218
Py_INCREF(fake_module);
10219
cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
10220
if (cached_type) {
10221
if (!PyType_Check((PyObject*)cached_type)) {
10222
PyErr_Format(PyExc_TypeError,
10223
"Shared Cython type %.200s is not a type object",
10224
type->tp_name);
10225
goto bad;
10226
}
10227
if (cached_type->tp_basicsize != type->tp_basicsize) {
10228
PyErr_Format(PyExc_TypeError,
10229
"Shared Cython type %.200s has the wrong size, try recompiling",
10230
type->tp_name);
10231
goto bad;
10232
}
10233
} else {
10234
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
10235
PyErr_Clear();
10236
if (PyType_Ready(type) < 0) goto bad;
10237
if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
10238
goto bad;
10239
Py_INCREF(type);
10240
cached_type = type;
10241
}
10242
done:
10243
Py_DECREF(fake_module);
10244
return cached_type;
10245
bad:
10246
Py_XDECREF(cached_type);
10247
cached_type = NULL;
10248
goto done;
10249
}
10250
10251
/* CythonFunction */
10252
static PyObject *
10253
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
10254
{
10255
if (unlikely(op->func_doc == NULL)) {
10256
if (op->func.m_ml->ml_doc) {
10257
#if PY_MAJOR_VERSION >= 3
10258
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
10259
#else
10260
op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
10261
#endif
10262
if (unlikely(op->func_doc == NULL))
10263
return NULL;
10264
} else {
10265
Py_INCREF(Py_None);
10266
return Py_None;
10267
}
10268
}
10269
Py_INCREF(op->func_doc);
10270
return op->func_doc;
10271
}
10272
static int
10273
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
10274
{
10275
PyObject *tmp = op->func_doc;
10276
if (value == NULL) {
10277
value = Py_None;
10278
}
10279
Py_INCREF(value);
10280
op->func_doc = value;
10281
Py_XDECREF(tmp);
10282
return 0;
10283
}
10284
static PyObject *
10285
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
10286
{
10287
if (unlikely(op->func_name == NULL)) {
10288
#if PY_MAJOR_VERSION >= 3
10289
op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
10290
#else
10291
op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
10292
#endif
10293
if (unlikely(op->func_name == NULL))
10294
return NULL;
10295
}
10296
Py_INCREF(op->func_name);
10297
return op->func_name;
10298
}
10299
static int
10300
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
10301
{
10302
PyObject *tmp;
10303
#if PY_MAJOR_VERSION >= 3
10304
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
10305
#else
10306
if (unlikely(value == NULL || !PyString_Check(value))) {
10307
#endif
10308
PyErr_SetString(PyExc_TypeError,
10309
"__name__ must be set to a string object");
10310
return -1;
10311
}
10312
tmp = op->func_name;
10313
Py_INCREF(value);
10314
op->func_name = value;
10315
Py_XDECREF(tmp);
10316
return 0;
10317
}
10318
static PyObject *
10319
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
10320
{
10321
Py_INCREF(op->func_qualname);
10322
return op->func_qualname;
10323
}
10324
static int
10325
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
10326
{
10327
PyObject *tmp;
10328
#if PY_MAJOR_VERSION >= 3
10329
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
10330
#else
10331
if (unlikely(value == NULL || !PyString_Check(value))) {
10332
#endif
10333
PyErr_SetString(PyExc_TypeError,
10334
"__qualname__ must be set to a string object");
10335
return -1;
10336
}
10337
tmp = op->func_qualname;
10338
Py_INCREF(value);
10339
op->func_qualname = value;
10340
Py_XDECREF(tmp);
10341
return 0;
10342
}
10343
static PyObject *
10344
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
10345
{
10346
PyObject *self;
10347
self = m->func_closure;
10348
if (self == NULL)
10349
self = Py_None;
10350
Py_INCREF(self);
10351
return self;
10352
}
10353
static PyObject *
10354
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
10355
{
10356
if (unlikely(op->func_dict == NULL)) {
10357
op->func_dict = PyDict_New();
10358
if (unlikely(op->func_dict == NULL))
10359
return NULL;
10360
}
10361
Py_INCREF(op->func_dict);
10362
return op->func_dict;
10363
}
10364
static int
10365
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
10366
{
10367
PyObject *tmp;
10368
if (unlikely(value == NULL)) {
10369
PyErr_SetString(PyExc_TypeError,
10370
"function's dictionary may not be deleted");
10371
return -1;
10372
}
10373
if (unlikely(!PyDict_Check(value))) {
10374
PyErr_SetString(PyExc_TypeError,
10375
"setting function's dictionary to a non-dict");
10376
return -1;
10377
}
10378
tmp = op->func_dict;
10379
Py_INCREF(value);
10380
op->func_dict = value;
10381
Py_XDECREF(tmp);
10382
return 0;
10383
}
10384
static PyObject *
10385
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
10386
{
10387
Py_INCREF(op->func_globals);
10388
return op->func_globals;
10389
}
10390
static PyObject *
10391
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
10392
{
10393
Py_INCREF(Py_None);
10394
return Py_None;
10395
}
10396
static PyObject *
10397
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
10398
{
10399
PyObject* result = (op->func_code) ? op->func_code : Py_None;
10400
Py_INCREF(result);
10401
return result;
10402
}
10403
static int
10404
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
10405
int result = 0;
10406
PyObject *res = op->defaults_getter((PyObject *) op);
10407
if (unlikely(!res))
10408
return -1;
10409
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10410
op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
10411
Py_INCREF(op->defaults_tuple);
10412
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
10413
Py_INCREF(op->defaults_kwdict);
10414
#else
10415
op->defaults_tuple = PySequence_ITEM(res, 0);
10416
if (unlikely(!op->defaults_tuple)) result = -1;
10417
else {
10418
op->defaults_kwdict = PySequence_ITEM(res, 1);
10419
if (unlikely(!op->defaults_kwdict)) result = -1;
10420
}
10421
#endif
10422
Py_DECREF(res);
10423
return result;
10424
}
10425
static int
10426
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
10427
PyObject* tmp;
10428
if (!value) {
10429
value = Py_None;
10430
} else if (value != Py_None && !PyTuple_Check(value)) {
10431
PyErr_SetString(PyExc_TypeError,
10432
"__defaults__ must be set to a tuple object");
10433
return -1;
10434
}
10435
Py_INCREF(value);
10436
tmp = op->defaults_tuple;
10437
op->defaults_tuple = value;
10438
Py_XDECREF(tmp);
10439
return 0;
10440
}
10441
static PyObject *
10442
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
10443
PyObject* result = op->defaults_tuple;
10444
if (unlikely(!result)) {
10445
if (op->defaults_getter) {
10446
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
10447
result = op->defaults_tuple;
10448
} else {
10449
result = Py_None;
10450
}
10451
}
10452
Py_INCREF(result);
10453
return result;
10454
}
10455
static int
10456
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
10457
PyObject* tmp;
10458
if (!value) {
10459
value = Py_None;
10460
} else if (value != Py_None && !PyDict_Check(value)) {
10461
PyErr_SetString(PyExc_TypeError,
10462
"__kwdefaults__ must be set to a dict object");
10463
return -1;
10464
}
10465
Py_INCREF(value);
10466
tmp = op->defaults_kwdict;
10467
op->defaults_kwdict = value;
10468
Py_XDECREF(tmp);
10469
return 0;
10470
}
10471
static PyObject *
10472
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
10473
PyObject* result = op->defaults_kwdict;
10474
if (unlikely(!result)) {
10475
if (op->defaults_getter) {
10476
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
10477
result = op->defaults_kwdict;
10478
} else {
10479
result = Py_None;
10480
}
10481
}
10482
Py_INCREF(result);
10483
return result;
10484
}
10485
static int
10486
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
10487
PyObject* tmp;
10488
if (!value || value == Py_None) {
10489
value = NULL;
10490
} else if (!PyDict_Check(value)) {
10491
PyErr_SetString(PyExc_TypeError,
10492
"__annotations__ must be set to a dict object");
10493
return -1;
10494
}
10495
Py_XINCREF(value);
10496
tmp = op->func_annotations;
10497
op->func_annotations = value;
10498
Py_XDECREF(tmp);
10499
return 0;
10500
}
10501
static PyObject *
10502
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
10503
PyObject* result = op->func_annotations;
10504
if (unlikely(!result)) {
10505
result = PyDict_New();
10506
if (unlikely(!result)) return NULL;
10507
op->func_annotations = result;
10508
}
10509
Py_INCREF(result);
10510
return result;
10511
}
10512
static PyGetSetDef __pyx_CyFunction_getsets[] = {
10513
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
10514
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
10515
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
10516
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
10517
{(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
10518
{(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
10519
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
10520
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
10521
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
10522
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
10523
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
10524
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
10525
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
10526
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
10527
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
10528
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
10529
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
10530
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
10531
{0, 0, 0, 0, 0}
10532
};
10533
static PyMemberDef __pyx_CyFunction_members[] = {
10534
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
10535
{0, 0, 0, 0, 0}
10536
};
10537
static PyObject *
10538
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
10539
{
10540
#if PY_MAJOR_VERSION >= 3
10541
return PyUnicode_FromString(m->func.m_ml->ml_name);
10542
#else
10543
return PyString_FromString(m->func.m_ml->ml_name);
10544
#endif
10545
}
10546
static PyMethodDef __pyx_CyFunction_methods[] = {
10547
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
10548
{0, 0, 0, 0}
10549
};
10550
#if PY_VERSION_HEX < 0x030500A0
10551
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
10552
#else
10553
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
10554
#endif
10555
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
10556
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
10557
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
10558
if (op == NULL)
10559
return NULL;
10560
op->flags = flags;
10561
__Pyx_CyFunction_weakreflist(op) = NULL;
10562
op->func.m_ml = ml;
10563
op->func.m_self = (PyObject *) op;
10564
Py_XINCREF(closure);
10565
op->func_closure = closure;
10566
Py_XINCREF(module);
10567
op->func.m_module = module;
10568
op->func_dict = NULL;
10569
op->func_name = NULL;
10570
Py_INCREF(qualname);
10571
op->func_qualname = qualname;
10572
op->func_doc = NULL;
10573
op->func_classobj = NULL;
10574
op->func_globals = globals;
10575
Py_INCREF(op->func_globals);
10576
Py_XINCREF(code);
10577
op->func_code = code;
10578
op->defaults_pyobjects = 0;
10579
op->defaults = NULL;
10580
op->defaults_tuple = NULL;
10581
op->defaults_kwdict = NULL;
10582
op->defaults_getter = NULL;
10583
op->func_annotations = NULL;
10584
PyObject_GC_Track(op);
10585
return (PyObject *) op;
10586
}
10587
static int
10588
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
10589
{
10590
Py_CLEAR(m->func_closure);
10591
Py_CLEAR(m->func.m_module);
10592
Py_CLEAR(m->func_dict);
10593
Py_CLEAR(m->func_name);
10594
Py_CLEAR(m->func_qualname);
10595
Py_CLEAR(m->func_doc);
10596
Py_CLEAR(m->func_globals);
10597
Py_CLEAR(m->func_code);
10598
Py_CLEAR(m->func_classobj);
10599
Py_CLEAR(m->defaults_tuple);
10600
Py_CLEAR(m->defaults_kwdict);
10601
Py_CLEAR(m->func_annotations);
10602
if (m->defaults) {
10603
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
10604
int i;
10605
for (i = 0; i < m->defaults_pyobjects; i++)
10606
Py_XDECREF(pydefaults[i]);
10607
PyObject_Free(m->defaults);
10608
m->defaults = NULL;
10609
}
10610
return 0;
10611
}
10612
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
10613
{
10614
PyObject_GC_UnTrack(m);
10615
if (__Pyx_CyFunction_weakreflist(m) != NULL)
10616
PyObject_ClearWeakRefs((PyObject *) m);
10617
__Pyx_CyFunction_clear(m);
10618
PyObject_GC_Del(m);
10619
}
10620
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
10621
{
10622
Py_VISIT(m->func_closure);
10623
Py_VISIT(m->func.m_module);
10624
Py_VISIT(m->func_dict);
10625
Py_VISIT(m->func_name);
10626
Py_VISIT(m->func_qualname);
10627
Py_VISIT(m->func_doc);
10628
Py_VISIT(m->func_globals);
10629
Py_VISIT(m->func_code);
10630
Py_VISIT(m->func_classobj);
10631
Py_VISIT(m->defaults_tuple);
10632
Py_VISIT(m->defaults_kwdict);
10633
if (m->defaults) {
10634
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
10635
int i;
10636
for (i = 0; i < m->defaults_pyobjects; i++)
10637
Py_VISIT(pydefaults[i]);
10638
}
10639
return 0;
10640
}
10641
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
10642
{
10643
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
10644
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
10645
Py_INCREF(func);
10646
return func;
10647
}
10648
if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
10649
if (type == NULL)
10650
type = (PyObject *)(Py_TYPE(obj));
10651
return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
10652
}
10653
if (obj == Py_None)
10654
obj = NULL;
10655
return __Pyx_PyMethod_New(func, obj, type);
10656
}
10657
static PyObject*
10658
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
10659
{
10660
#if PY_MAJOR_VERSION >= 3
10661
return PyUnicode_FromFormat("<cyfunction %U at %p>",
10662
op->func_qualname, (void *)op);
10663
#else
10664
return PyString_FromFormat("<cyfunction %s at %p>",
10665
PyString_AsString(op->func_qualname), (void *)op);
10666
#endif
10667
}
10668
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
10669
PyCFunctionObject* f = (PyCFunctionObject*)func;
10670
PyCFunction meth = f->m_ml->ml_meth;
10671
Py_ssize_t size;
10672
switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
10673
case METH_VARARGS:
10674
if (likely(kw == NULL || PyDict_Size(kw) == 0))
10675
return (*meth)(self, arg);
10676
break;
10677
case METH_VARARGS | METH_KEYWORDS:
10678
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
10679
case METH_NOARGS:
10680
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
10681
size = PyTuple_GET_SIZE(arg);
10682
if (likely(size == 0))
10683
return (*meth)(self, NULL);
10684
PyErr_Format(PyExc_TypeError,
10685
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
10686
f->m_ml->ml_name, size);
10687
return NULL;
10688
}
10689
break;
10690
case METH_O:
10691
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
10692
size = PyTuple_GET_SIZE(arg);
10693
if (likely(size == 1)) {
10694
PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
10695
if (unlikely(!arg0)) return NULL;
10696
result = (*meth)(self, arg0);
10697
Py_DECREF(arg0);
10698
return result;
10699
}
10700
PyErr_Format(PyExc_TypeError,
10701
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
10702
f->m_ml->ml_name, size);
10703
return NULL;
10704
}
10705
break;
10706
default:
10707
PyErr_SetString(PyExc_SystemError, "Bad call flags in "
10708
"__Pyx_CyFunction_Call. METH_OLDARGS is no "
10709
"longer supported!");
10710
return NULL;
10711
}
10712
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
10713
f->m_ml->ml_name);
10714
return NULL;
10715
}
10716
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
10717
return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
10718
}
10719
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
10720
PyObject *result;
10721
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
10722
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
10723
Py_ssize_t argc;
10724
PyObject *new_args;
10725
PyObject *self;
10726
argc = PyTuple_GET_SIZE(args);
10727
new_args = PyTuple_GetSlice(args, 1, argc);
10728
if (unlikely(!new_args))
10729
return NULL;
10730
self = PyTuple_GetItem(args, 0);
10731
if (unlikely(!self)) {
10732
Py_DECREF(new_args);
10733
return NULL;
10734
}
10735
result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
10736
Py_DECREF(new_args);
10737
} else {
10738
result = __Pyx_CyFunction_Call(func, args, kw);
10739
}
10740
return result;
10741
}
10742
static PyTypeObject __pyx_CyFunctionType_type = {
10743
PyVarObject_HEAD_INIT(0, 0)
10744
"cython_function_or_method",
10745
sizeof(__pyx_CyFunctionObject),
10746
0,
10747
(destructor) __Pyx_CyFunction_dealloc,
10748
0,
10749
0,
10750
0,
10751
#if PY_MAJOR_VERSION < 3
10752
0,
10753
#else
10754
0,
10755
#endif
10756
(reprfunc) __Pyx_CyFunction_repr,
10757
0,
10758
0,
10759
0,
10760
0,
10761
__Pyx_CyFunction_CallAsMethod,
10762
0,
10763
0,
10764
0,
10765
0,
10766
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
10767
0,
10768
(traverseproc) __Pyx_CyFunction_traverse,
10769
(inquiry) __Pyx_CyFunction_clear,
10770
0,
10771
#if PY_VERSION_HEX < 0x030500A0
10772
offsetof(__pyx_CyFunctionObject, func_weakreflist),
10773
#else
10774
offsetof(PyCFunctionObject, m_weakreflist),
10775
#endif
10776
0,
10777
0,
10778
__pyx_CyFunction_methods,
10779
__pyx_CyFunction_members,
10780
__pyx_CyFunction_getsets,
10781
0,
10782
0,
10783
__Pyx_CyFunction_descr_get,
10784
0,
10785
offsetof(__pyx_CyFunctionObject, func_dict),
10786
0,
10787
0,
10788
0,
10789
0,
10790
0,
10791
0,
10792
0,
10793
0,
10794
0,
10795
0,
10796
0,
10797
0,
10798
#if PY_VERSION_HEX >= 0x030400a1
10799
0,
10800
#endif
10801
};
10802
static int __pyx_CyFunction_init(void) {
10803
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
10804
if (__pyx_CyFunctionType == NULL) {
10805
return -1;
10806
}
10807
return 0;
10808
}
10809
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
10810
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
10811
m->defaults = PyObject_Malloc(size);
10812
if (!m->defaults)
10813
return PyErr_NoMemory();
10814
memset(m->defaults, 0, size);
10815
m->defaults_pyobjects = pyobjects;
10816
return m->defaults;
10817
}
10818
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
10819
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
10820
m->defaults_tuple = tuple;
10821
Py_INCREF(tuple);
10822
}
10823
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
10824
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
10825
m->defaults_kwdict = dict;
10826
Py_INCREF(dict);
10827
}
10828
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
10829
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
10830
m->func_annotations = dict;
10831
Py_INCREF(dict);
10832
}
10833
10834
/* GetVTable */
10835
static void* __Pyx_GetVtable(PyObject *dict) {
10836
void* ptr;
10837
PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
10838
if (!ob)
10839
goto bad;
10840
#if PY_VERSION_HEX >= 0x02070000
10841
ptr = PyCapsule_GetPointer(ob, 0);
10842
#else
10843
ptr = PyCObject_AsVoidPtr(ob);
10844
#endif
10845
if (!ptr && !PyErr_Occurred())
10846
PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
10847
Py_DECREF(ob);
10848
return ptr;
10849
bad:
10850
Py_XDECREF(ob);
10851
return NULL;
10852
}
10853
10854
/* CodeObjectCache */
10855
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
10856
int start = 0, mid = 0, end = count - 1;
10857
if (end >= 0 && code_line > entries[end].code_line) {
10858
return count;
10859
}
10860
while (start < end) {
10861
mid = start + (end - start) / 2;
10862
if (code_line < entries[mid].code_line) {
10863
end = mid;
10864
} else if (code_line > entries[mid].code_line) {
10865
start = mid + 1;
10866
} else {
10867
return mid;
10868
}
10869
}
10870
if (code_line <= entries[mid].code_line) {
10871
return mid;
10872
} else {
10873
return mid + 1;
10874
}
10875
}
10876
static PyCodeObject *__pyx_find_code_object(int code_line) {
10877
PyCodeObject* code_object;
10878
int pos;
10879
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
10880
return NULL;
10881
}
10882
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
10883
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
10884
return NULL;
10885
}
10886
code_object = __pyx_code_cache.entries[pos].code_object;
10887
Py_INCREF(code_object);
10888
return code_object;
10889
}
10890
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
10891
int pos, i;
10892
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
10893
if (unlikely(!code_line)) {
10894
return;
10895
}
10896
if (unlikely(!entries)) {
10897
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
10898
if (likely(entries)) {
10899
__pyx_code_cache.entries = entries;
10900
__pyx_code_cache.max_count = 64;
10901
__pyx_code_cache.count = 1;
10902
entries[0].code_line = code_line;
10903
entries[0].code_object = code_object;
10904
Py_INCREF(code_object);
10905
}
10906
return;
10907
}
10908
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
10909
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
10910
PyCodeObject* tmp = entries[pos].code_object;
10911
entries[pos].code_object = code_object;
10912
Py_DECREF(tmp);
10913
return;
10914
}
10915
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
10916
int new_max = __pyx_code_cache.max_count + 64;
10917
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
10918
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
10919
if (unlikely(!entries)) {
10920
return;
10921
}
10922
__pyx_code_cache.entries = entries;
10923
__pyx_code_cache.max_count = new_max;
10924
}
10925
for (i=__pyx_code_cache.count; i>pos; i--) {
10926
entries[i] = entries[i-1];
10927
}
10928
entries[pos].code_line = code_line;
10929
entries[pos].code_object = code_object;
10930
__pyx_code_cache.count++;
10931
Py_INCREF(code_object);
10932
}
10933
10934
/* AddTraceback */
10935
#include "compile.h"
10936
#include "frameobject.h"
10937
#include "traceback.h"
10938
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
10939
const char *funcname, int c_line,
10940
int py_line, const char *filename) {
10941
PyCodeObject *py_code = 0;
10942
PyObject *py_srcfile = 0;
10943
PyObject *py_funcname = 0;
10944
#if PY_MAJOR_VERSION < 3
10945
py_srcfile = PyString_FromString(filename);
10946
#else
10947
py_srcfile = PyUnicode_FromString(filename);
10948
#endif
10949
if (!py_srcfile) goto bad;
10950
if (c_line) {
10951
#if PY_MAJOR_VERSION < 3
10952
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
10953
#else
10954
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
10955
#endif
10956
}
10957
else {
10958
#if PY_MAJOR_VERSION < 3
10959
py_funcname = PyString_FromString(funcname);
10960
#else
10961
py_funcname = PyUnicode_FromString(funcname);
10962
#endif
10963
}
10964
if (!py_funcname) goto bad;
10965
py_code = __Pyx_PyCode_New(
10966
0,
10967
0,
10968
0,
10969
0,
10970
0,
10971
__pyx_empty_bytes, /*PyObject *code,*/
10972
__pyx_empty_tuple, /*PyObject *consts,*/
10973
__pyx_empty_tuple, /*PyObject *names,*/
10974
__pyx_empty_tuple, /*PyObject *varnames,*/
10975
__pyx_empty_tuple, /*PyObject *freevars,*/
10976
__pyx_empty_tuple, /*PyObject *cellvars,*/
10977
py_srcfile, /*PyObject *filename,*/
10978
py_funcname, /*PyObject *name,*/
10979
py_line,
10980
__pyx_empty_bytes /*PyObject *lnotab*/
10981
);
10982
Py_DECREF(py_srcfile);
10983
Py_DECREF(py_funcname);
10984
return py_code;
10985
bad:
10986
Py_XDECREF(py_srcfile);
10987
Py_XDECREF(py_funcname);
10988
return NULL;
10989
}
10990
static void __Pyx_AddTraceback(const char *funcname, int c_line,
10991
int py_line, const char *filename) {
10992
PyCodeObject *py_code = 0;
10993
PyFrameObject *py_frame = 0;
10994
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
10995
if (!py_code) {
10996
py_code = __Pyx_CreateCodeObjectForTraceback(
10997
funcname, c_line, py_line, filename);
10998
if (!py_code) goto bad;
10999
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
11000
}
11001
py_frame = PyFrame_New(
11002
PyThreadState_GET(), /*PyThreadState *tstate,*/
11003
py_code, /*PyCodeObject *code,*/
11004
__pyx_d, /*PyObject *globals,*/
11005
0 /*PyObject *locals*/
11006
);
11007
if (!py_frame) goto bad;
11008
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
11009
PyTraceBack_Here(py_frame);
11010
bad:
11011
Py_XDECREF(py_code);
11012
Py_XDECREF(py_frame);
11013
}
11014
11015
/* CIntToPy */
11016
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
11017
const long neg_one = (long) -1, const_zero = (long) 0;
11018
const int is_unsigned = neg_one > const_zero;
11019
if (is_unsigned) {
11020
if (sizeof(long) < sizeof(long)) {
11021
return PyInt_FromLong((long) value);
11022
} else if (sizeof(long) <= sizeof(unsigned long)) {
11023
return PyLong_FromUnsignedLong((unsigned long) value);
11024
#ifdef HAVE_LONG_LONG
11025
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
11026
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
11027
#endif
11028
}
11029
} else {
11030
if (sizeof(long) <= sizeof(long)) {
11031
return PyInt_FromLong((long) value);
11032
#ifdef HAVE_LONG_LONG
11033
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
11034
return PyLong_FromLongLong((PY_LONG_LONG) value);
11035
#endif
11036
}
11037
}
11038
{
11039
int one = 1; int little = (int)*(unsigned char *)&one;
11040
unsigned char *bytes = (unsigned char *)&value;
11041
return _PyLong_FromByteArray(bytes, sizeof(long),
11042
little, !is_unsigned);
11043
}
11044
}
11045
11046
/* CIntFromPyVerify */
11047
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
11048
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
11049
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
11050
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
11051
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
11052
{\
11053
func_type value = func_value;\
11054
if (sizeof(target_type) < sizeof(func_type)) {\
11055
if (unlikely(value != (func_type) (target_type) value)) {\
11056
func_type zero = 0;\
11057
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
11058
return (target_type) -1;\
11059
if (is_unsigned && unlikely(value < zero))\
11060
goto raise_neg_overflow;\
11061
else\
11062
goto raise_overflow;\
11063
}\
11064
}\
11065
return (target_type) value;\
11066
}
11067
11068
/* CIntFromPy */
11069
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
11070
const int neg_one = (int) -1, const_zero = (int) 0;
11071
const int is_unsigned = neg_one > const_zero;
11072
#if PY_MAJOR_VERSION < 3
11073
if (likely(PyInt_Check(x))) {
11074
if (sizeof(int) < sizeof(long)) {
11075
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
11076
} else {
11077
long val = PyInt_AS_LONG(x);
11078
if (is_unsigned && unlikely(val < 0)) {
11079
goto raise_neg_overflow;
11080
}
11081
return (int) val;
11082
}
11083
} else
11084
#endif
11085
if (likely(PyLong_Check(x))) {
11086
if (is_unsigned) {
11087
#if CYTHON_USE_PYLONG_INTERNALS
11088
const digit* digits = ((PyLongObject*)x)->ob_digit;
11089
switch (Py_SIZE(x)) {
11090
case 0: return (int) 0;
11091
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
11092
case 2:
11093
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
11094
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11095
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11096
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
11097
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11098
}
11099
}
11100
break;
11101
case 3:
11102
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
11103
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11104
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11105
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
11106
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11107
}
11108
}
11109
break;
11110
case 4:
11111
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
11112
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11113
__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])))
11114
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
11115
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
11116
}
11117
}
11118
break;
11119
}
11120
#endif
11121
#if CYTHON_COMPILING_IN_CPYTHON
11122
if (unlikely(Py_SIZE(x) < 0)) {
11123
goto raise_neg_overflow;
11124
}
11125
#else
11126
{
11127
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
11128
if (unlikely(result < 0))
11129
return (int) -1;
11130
if (unlikely(result == 1))
11131
goto raise_neg_overflow;
11132
}
11133
#endif
11134
if (sizeof(int) <= sizeof(unsigned long)) {
11135
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
11136
#ifdef HAVE_LONG_LONG
11137
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
11138
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
11139
#endif
11140
}
11141
} else {
11142
#if CYTHON_USE_PYLONG_INTERNALS
11143
const digit* digits = ((PyLongObject*)x)->ob_digit;
11144
switch (Py_SIZE(x)) {
11145
case 0: return (int) 0;
11146
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
11147
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
11148
case -2:
11149
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
11150
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11151
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11152
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11153
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11154
}
11155
}
11156
break;
11157
case 2:
11158
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
11159
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11160
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11161
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11162
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11163
}
11164
}
11165
break;
11166
case -3:
11167
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
11168
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11169
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11170
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11171
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11172
}
11173
}
11174
break;
11175
case 3:
11176
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
11177
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11178
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11179
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11180
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11181
}
11182
}
11183
break;
11184
case -4:
11185
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
11186
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11187
__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])))
11188
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
11189
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11190
}
11191
}
11192
break;
11193
case 4:
11194
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
11195
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11196
__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])))
11197
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
11198
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
11199
}
11200
}
11201
break;
11202
}
11203
#endif
11204
if (sizeof(int) <= sizeof(long)) {
11205
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
11206
#ifdef HAVE_LONG_LONG
11207
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
11208
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
11209
#endif
11210
}
11211
}
11212
{
11213
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
11214
PyErr_SetString(PyExc_RuntimeError,
11215
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
11216
#else
11217
int val;
11218
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
11219
#if PY_MAJOR_VERSION < 3
11220
if (likely(v) && !PyLong_Check(v)) {
11221
PyObject *tmp = v;
11222
v = PyNumber_Long(tmp);
11223
Py_DECREF(tmp);
11224
}
11225
#endif
11226
if (likely(v)) {
11227
int one = 1; int is_little = (int)*(unsigned char *)&one;
11228
unsigned char *bytes = (unsigned char *)&val;
11229
int ret = _PyLong_AsByteArray((PyLongObject *)v,
11230
bytes, sizeof(val),
11231
is_little, !is_unsigned);
11232
Py_DECREF(v);
11233
if (likely(!ret))
11234
return val;
11235
}
11236
#endif
11237
return (int) -1;
11238
}
11239
} else {
11240
int val;
11241
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
11242
if (!tmp) return (int) -1;
11243
val = __Pyx_PyInt_As_int(tmp);
11244
Py_DECREF(tmp);
11245
return val;
11246
}
11247
raise_overflow:
11248
PyErr_SetString(PyExc_OverflowError,
11249
"value too large to convert to int");
11250
return (int) -1;
11251
raise_neg_overflow:
11252
PyErr_SetString(PyExc_OverflowError,
11253
"can't convert negative value to int");
11254
return (int) -1;
11255
}
11256
11257
/* CIntFromPy */
11258
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
11259
const long neg_one = (long) -1, const_zero = (long) 0;
11260
const int is_unsigned = neg_one > const_zero;
11261
#if PY_MAJOR_VERSION < 3
11262
if (likely(PyInt_Check(x))) {
11263
if (sizeof(long) < sizeof(long)) {
11264
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
11265
} else {
11266
long val = PyInt_AS_LONG(x);
11267
if (is_unsigned && unlikely(val < 0)) {
11268
goto raise_neg_overflow;
11269
}
11270
return (long) val;
11271
}
11272
} else
11273
#endif
11274
if (likely(PyLong_Check(x))) {
11275
if (is_unsigned) {
11276
#if CYTHON_USE_PYLONG_INTERNALS
11277
const digit* digits = ((PyLongObject*)x)->ob_digit;
11278
switch (Py_SIZE(x)) {
11279
case 0: return (long) 0;
11280
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
11281
case 2:
11282
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
11283
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11284
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11285
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
11286
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
11287
}
11288
}
11289
break;
11290
case 3:
11291
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
11292
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11293
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11294
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
11295
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
11296
}
11297
}
11298
break;
11299
case 4:
11300
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
11301
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11302
__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])))
11303
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
11304
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
11305
}
11306
}
11307
break;
11308
}
11309
#endif
11310
#if CYTHON_COMPILING_IN_CPYTHON
11311
if (unlikely(Py_SIZE(x) < 0)) {
11312
goto raise_neg_overflow;
11313
}
11314
#else
11315
{
11316
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
11317
if (unlikely(result < 0))
11318
return (long) -1;
11319
if (unlikely(result == 1))
11320
goto raise_neg_overflow;
11321
}
11322
#endif
11323
if (sizeof(long) <= sizeof(unsigned long)) {
11324
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
11325
#ifdef HAVE_LONG_LONG
11326
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
11327
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
11328
#endif
11329
}
11330
} else {
11331
#if CYTHON_USE_PYLONG_INTERNALS
11332
const digit* digits = ((PyLongObject*)x)->ob_digit;
11333
switch (Py_SIZE(x)) {
11334
case 0: return (long) 0;
11335
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
11336
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
11337
case -2:
11338
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
11339
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11340
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11341
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
11342
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11343
}
11344
}
11345
break;
11346
case 2:
11347
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
11348
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
11349
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11350
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
11351
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11352
}
11353
}
11354
break;
11355
case -3:
11356
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
11357
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11358
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11359
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
11360
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11361
}
11362
}
11363
break;
11364
case 3:
11365
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
11366
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
11367
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
11368
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
11369
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11370
}
11371
}
11372
break;
11373
case -4:
11374
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
11375
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11376
__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])))
11377
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
11378
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11379
}
11380
}
11381
break;
11382
case 4:
11383
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
11384
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
11385
__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])))
11386
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
11387
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
11388
}
11389
}
11390
break;
11391
}
11392
#endif
11393
if (sizeof(long) <= sizeof(long)) {
11394
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
11395
#ifdef HAVE_LONG_LONG
11396
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
11397
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
11398
#endif
11399
}
11400
}
11401
{
11402
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
11403
PyErr_SetString(PyExc_RuntimeError,
11404
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
11405
#else
11406
long val;
11407
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
11408
#if PY_MAJOR_VERSION < 3
11409
if (likely(v) && !PyLong_Check(v)) {
11410
PyObject *tmp = v;
11411
v = PyNumber_Long(tmp);
11412
Py_DECREF(tmp);
11413
}
11414
#endif
11415
if (likely(v)) {
11416
int one = 1; int is_little = (int)*(unsigned char *)&one;
11417
unsigned char *bytes = (unsigned char *)&val;
11418
int ret = _PyLong_AsByteArray((PyLongObject *)v,
11419
bytes, sizeof(val),
11420
is_little, !is_unsigned);
11421
Py_DECREF(v);
11422
if (likely(!ret))
11423
return val;
11424
}
11425
#endif
11426
return (long) -1;
11427
}
11428
} else {
11429
long val;
11430
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
11431
if (!tmp) return (long) -1;
11432
val = __Pyx_PyInt_As_long(tmp);
11433
Py_DECREF(tmp);
11434
return val;
11435
}
11436
raise_overflow:
11437
PyErr_SetString(PyExc_OverflowError,
11438
"value too large to convert to long");
11439
return (long) -1;
11440
raise_neg_overflow:
11441
PyErr_SetString(PyExc_OverflowError,
11442
"can't convert negative value to long");
11443
return (long) -1;
11444
}
11445
11446
/* CheckBinaryVersion */
11447
static int __Pyx_check_binary_version(void) {
11448
char ctversion[4], rtversion[4];
11449
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
11450
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
11451
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
11452
char message[200];
11453
PyOS_snprintf(message, sizeof(message),
11454
"compiletime version %s of module '%.100s' "
11455
"does not match runtime version %s",
11456
ctversion, __Pyx_MODULE_NAME, rtversion);
11457
return PyErr_WarnEx(NULL, message, 1);
11458
}
11459
return 0;
11460
}
11461
11462
/* ModuleImport */
11463
#ifndef __PYX_HAVE_RT_ImportModule
11464
#define __PYX_HAVE_RT_ImportModule
11465
static PyObject *__Pyx_ImportModule(const char *name) {
11466
PyObject *py_name = 0;
11467
PyObject *py_module = 0;
11468
py_name = __Pyx_PyIdentifier_FromString(name);
11469
if (!py_name)
11470
goto bad;
11471
py_module = PyImport_Import(py_name);
11472
Py_DECREF(py_name);
11473
return py_module;
11474
bad:
11475
Py_XDECREF(py_name);
11476
return 0;
11477
}
11478
#endif
11479
11480
/* TypeImport */
11481
#ifndef __PYX_HAVE_RT_ImportType
11482
#define __PYX_HAVE_RT_ImportType
11483
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
11484
size_t size, int strict)
11485
{
11486
PyObject *py_module = 0;
11487
PyObject *result = 0;
11488
PyObject *py_name = 0;
11489
char warning[200];
11490
Py_ssize_t basicsize;
11491
#ifdef Py_LIMITED_API
11492
PyObject *py_basicsize;
11493
#endif
11494
py_module = __Pyx_ImportModule(module_name);
11495
if (!py_module)
11496
goto bad;
11497
py_name = __Pyx_PyIdentifier_FromString(class_name);
11498
if (!py_name)
11499
goto bad;
11500
result = PyObject_GetAttr(py_module, py_name);
11501
Py_DECREF(py_name);
11502
py_name = 0;
11503
Py_DECREF(py_module);
11504
py_module = 0;
11505
if (!result)
11506
goto bad;
11507
if (!PyType_Check(result)) {
11508
PyErr_Format(PyExc_TypeError,
11509
"%.200s.%.200s is not a type object",
11510
module_name, class_name);
11511
goto bad;
11512
}
11513
#ifndef Py_LIMITED_API
11514
basicsize = ((PyTypeObject *)result)->tp_basicsize;
11515
#else
11516
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
11517
if (!py_basicsize)
11518
goto bad;
11519
basicsize = PyLong_AsSsize_t(py_basicsize);
11520
Py_DECREF(py_basicsize);
11521
py_basicsize = 0;
11522
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
11523
goto bad;
11524
#endif
11525
if (!strict && (size_t)basicsize > size) {
11526
PyOS_snprintf(warning, sizeof(warning),
11527
"%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
11528
module_name, class_name, basicsize, size);
11529
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
11530
}
11531
else if ((size_t)basicsize != size) {
11532
PyErr_Format(PyExc_ValueError,
11533
"%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
11534
module_name, class_name, basicsize, size);
11535
goto bad;
11536
}
11537
return (PyTypeObject *)result;
11538
bad:
11539
Py_XDECREF(py_module);
11540
Py_XDECREF(result);
11541
return NULL;
11542
}
11543
#endif
11544
11545
/* VoidPtrImport */
11546
#ifndef __PYX_HAVE_RT_ImportVoidPtr
11547
#define __PYX_HAVE_RT_ImportVoidPtr
11548
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
11549
PyObject *d = 0;
11550
PyObject *cobj = 0;
11551
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
11552
if (!d)
11553
goto bad;
11554
cobj = PyDict_GetItemString(d, name);
11555
if (!cobj) {
11556
PyErr_Format(PyExc_ImportError,
11557
"%.200s does not export expected C variable %.200s",
11558
PyModule_GetName(module), name);
11559
goto bad;
11560
}
11561
#if PY_VERSION_HEX >= 0x02070000
11562
if (!PyCapsule_IsValid(cobj, sig)) {
11563
PyErr_Format(PyExc_TypeError,
11564
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
11565
PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
11566
goto bad;
11567
}
11568
*p = PyCapsule_GetPointer(cobj, sig);
11569
#else
11570
{const char *desc, *s1, *s2;
11571
desc = (const char *)PyCObject_GetDesc(cobj);
11572
if (!desc)
11573
goto bad;
11574
s1 = desc; s2 = sig;
11575
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
11576
if (*s1 != *s2) {
11577
PyErr_Format(PyExc_TypeError,
11578
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
11579
PyModule_GetName(module), name, sig, desc);
11580
goto bad;
11581
}
11582
*p = PyCObject_AsVoidPtr(cobj);}
11583
#endif
11584
if (!(*p))
11585
goto bad;
11586
Py_DECREF(d);
11587
return 0;
11588
bad:
11589
Py_XDECREF(d);
11590
return -1;
11591
}
11592
#endif
11593
11594
/* InitStrings */
11595
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
11596
while (t->p) {
11597
#if PY_MAJOR_VERSION < 3
11598
if (t->is_unicode) {
11599
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
11600
} else if (t->intern) {
11601
*t->p = PyString_InternFromString(t->s);
11602
} else {
11603
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
11604
}
11605
#else
11606
if (t->is_unicode | t->is_str) {
11607
if (t->intern) {
11608
*t->p = PyUnicode_InternFromString(t->s);
11609
} else if (t->encoding) {
11610
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
11611
} else {
11612
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
11613
}
11614
} else {
11615
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
11616
}
11617
#endif
11618
if (!*t->p)
11619
return -1;
11620
++t;
11621
}
11622
return 0;
11623
}
11624
11625
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
11626
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
11627
}
11628
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
11629
Py_ssize_t ignore;
11630
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
11631
}
11632
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11633
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
11634
if (
11635
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11636
__Pyx_sys_getdefaultencoding_not_ascii &&
11637
#endif
11638
PyUnicode_Check(o)) {
11639
#if PY_VERSION_HEX < 0x03030000
11640
char* defenc_c;
11641
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
11642
if (!defenc) return NULL;
11643
defenc_c = PyBytes_AS_STRING(defenc);
11644
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11645
{
11646
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
11647
char* c;
11648
for (c = defenc_c; c < end; c++) {
11649
if ((unsigned char) (*c) >= 128) {
11650
PyUnicode_AsASCIIString(o);
11651
return NULL;
11652
}
11653
}
11654
}
11655
#endif
11656
*length = PyBytes_GET_SIZE(defenc);
11657
return defenc_c;
11658
#else
11659
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
11660
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11661
if (PyUnicode_IS_ASCII(o)) {
11662
*length = PyUnicode_GET_LENGTH(o);
11663
return PyUnicode_AsUTF8(o);
11664
} else {
11665
PyUnicode_AsASCIIString(o);
11666
return NULL;
11667
}
11668
#else
11669
return PyUnicode_AsUTF8AndSize(o, length);
11670
#endif
11671
#endif
11672
} else
11673
#endif
11674
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
11675
if (PyByteArray_Check(o)) {
11676
*length = PyByteArray_GET_SIZE(o);
11677
return PyByteArray_AS_STRING(o);
11678
} else
11679
#endif
11680
{
11681
char* result;
11682
int r = PyBytes_AsStringAndSize(o, &result, length);
11683
if (unlikely(r < 0)) {
11684
return NULL;
11685
} else {
11686
return result;
11687
}
11688
}
11689
}
11690
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
11691
int is_true = x == Py_True;
11692
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
11693
else return PyObject_IsTrue(x);
11694
}
11695
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
11696
#if CYTHON_USE_TYPE_SLOTS
11697
PyNumberMethods *m;
11698
#endif
11699
const char *name = NULL;
11700
PyObject *res = NULL;
11701
#if PY_MAJOR_VERSION < 3
11702
if (PyInt_Check(x) || PyLong_Check(x))
11703
#else
11704
if (PyLong_Check(x))
11705
#endif
11706
return __Pyx_NewRef(x);
11707
#if CYTHON_USE_TYPE_SLOTS
11708
m = Py_TYPE(x)->tp_as_number;
11709
#if PY_MAJOR_VERSION < 3
11710
if (m && m->nb_int) {
11711
name = "int";
11712
res = PyNumber_Int(x);
11713
}
11714
else if (m && m->nb_long) {
11715
name = "long";
11716
res = PyNumber_Long(x);
11717
}
11718
#else
11719
if (m && m->nb_int) {
11720
name = "int";
11721
res = PyNumber_Long(x);
11722
}
11723
#endif
11724
#else
11725
res = PyNumber_Int(x);
11726
#endif
11727
if (res) {
11728
#if PY_MAJOR_VERSION < 3
11729
if (!PyInt_Check(res) && !PyLong_Check(res)) {
11730
#else
11731
if (!PyLong_Check(res)) {
11732
#endif
11733
PyErr_Format(PyExc_TypeError,
11734
"__%.4s__ returned non-%.4s (type %.200s)",
11735
name, name, Py_TYPE(res)->tp_name);
11736
Py_DECREF(res);
11737
return NULL;
11738
}
11739
}
11740
else if (!PyErr_Occurred()) {
11741
PyErr_SetString(PyExc_TypeError,
11742
"an integer is required");
11743
}
11744
return res;
11745
}
11746
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
11747
Py_ssize_t ival;
11748
PyObject *x;
11749
#if PY_MAJOR_VERSION < 3
11750
if (likely(PyInt_CheckExact(b))) {
11751
if (sizeof(Py_ssize_t) >= sizeof(long))
11752
return PyInt_AS_LONG(b);
11753
else
11754
return PyInt_AsSsize_t(x);
11755
}
11756
#endif
11757
if (likely(PyLong_CheckExact(b))) {
11758
#if CYTHON_USE_PYLONG_INTERNALS
11759
const digit* digits = ((PyLongObject*)b)->ob_digit;
11760
const Py_ssize_t size = Py_SIZE(b);
11761
if (likely(__Pyx_sst_abs(size) <= 1)) {
11762
ival = likely(size) ? digits[0] : 0;
11763
if (size == -1) ival = -ival;
11764
return ival;
11765
} else {
11766
switch (size) {
11767
case 2:
11768
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11769
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11770
}
11771
break;
11772
case -2:
11773
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11774
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11775
}
11776
break;
11777
case 3:
11778
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11779
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11780
}
11781
break;
11782
case -3:
11783
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11784
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11785
}
11786
break;
11787
case 4:
11788
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11789
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]));
11790
}
11791
break;
11792
case -4:
11793
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11794
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]));
11795
}
11796
break;
11797
}
11798
}
11799
#endif
11800
return PyLong_AsSsize_t(b);
11801
}
11802
x = PyNumber_Index(b);
11803
if (!x) return -1;
11804
ival = PyInt_AsSsize_t(x);
11805
Py_DECREF(x);
11806
return ival;
11807
}
11808
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
11809
return PyInt_FromSize_t(ival);
11810
}
11811
11812
11813
#endif /* Py_PYTHON_H */
11814
11815