Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241849 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__sqrt5
431
#define __PYX_HAVE_API__code__alex__psage__psage__ellcurve__lseries__sqrt5
432
#include <stdint.h>
433
#include <string.h>
434
#include <stdio.h>
435
#include "pythread.h"
436
#include "gmp.h"
437
#include "sage/libs/ntl/ntlwrap.h"
438
#include "sage/misc/cython_metaclass.h"
439
#include "pari/pari.h"
440
#include "struct_signals.h"
441
#include "pxi.h"
442
#include <stdlib.h>
443
#ifdef _OPENMP
444
#include <omp.h>
445
#endif /* _OPENMP */
446
447
#ifdef PYREX_WITHOUT_ASSERTIONS
448
#define CYTHON_WITHOUT_ASSERTIONS
449
#endif
450
451
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
452
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
453
454
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
455
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
456
#define __PYX_DEFAULT_STRING_ENCODING ""
457
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
458
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
459
#define __Pyx_uchar_cast(c) ((unsigned char)c)
460
#define __Pyx_long_cast(x) ((long)x)
461
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
462
(sizeof(type) < sizeof(Py_ssize_t)) ||\
463
(sizeof(type) > sizeof(Py_ssize_t) &&\
464
likely(v < (type)PY_SSIZE_T_MAX ||\
465
v == (type)PY_SSIZE_T_MAX) &&\
466
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
467
v == (type)PY_SSIZE_T_MIN))) ||\
468
(sizeof(type) == sizeof(Py_ssize_t) &&\
469
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
470
v == (type)PY_SSIZE_T_MAX))) )
471
#if defined (__cplusplus) && __cplusplus >= 201103L
472
#include <cstdlib>
473
#define __Pyx_sst_abs(value) std::abs(value)
474
#elif SIZEOF_INT >= SIZEOF_SIZE_T
475
#define __Pyx_sst_abs(value) abs(value)
476
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
477
#define __Pyx_sst_abs(value) labs(value)
478
#elif defined (_MSC_VER) && defined (_M_X64)
479
#define __Pyx_sst_abs(value) _abs64(value)
480
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
481
#define __Pyx_sst_abs(value) llabs(value)
482
#elif defined (__GNUC__)
483
#define __Pyx_sst_abs(value) __builtin_llabs(value)
484
#else
485
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
486
#endif
487
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
488
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
489
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
490
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
491
#define __Pyx_PyBytes_FromString PyBytes_FromString
492
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
493
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
494
#if PY_MAJOR_VERSION < 3
495
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
496
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
497
#else
498
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
499
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
500
#endif
501
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
502
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
503
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
504
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
505
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
506
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
507
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
508
#if PY_MAJOR_VERSION < 3
509
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
510
{
511
const Py_UNICODE *u_end = u;
512
while (*u_end++) ;
513
return (size_t)(u_end - u - 1);
514
}
515
#else
516
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
517
#endif
518
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
519
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
520
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
521
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
522
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
523
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
524
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
525
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
526
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
527
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
528
#if CYTHON_ASSUME_SAFE_MACROS
529
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
530
#else
531
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
532
#endif
533
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
534
#if PY_MAJOR_VERSION >= 3
535
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
536
#else
537
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
538
#endif
539
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
540
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
541
static int __Pyx_sys_getdefaultencoding_not_ascii;
542
static int __Pyx_init_sys_getdefaultencoding_params(void) {
543
PyObject* sys;
544
PyObject* default_encoding = NULL;
545
PyObject* ascii_chars_u = NULL;
546
PyObject* ascii_chars_b = NULL;
547
const char* default_encoding_c;
548
sys = PyImport_ImportModule("sys");
549
if (!sys) goto bad;
550
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
551
Py_DECREF(sys);
552
if (!default_encoding) goto bad;
553
default_encoding_c = PyBytes_AsString(default_encoding);
554
if (!default_encoding_c) goto bad;
555
if (strcmp(default_encoding_c, "ascii") == 0) {
556
__Pyx_sys_getdefaultencoding_not_ascii = 0;
557
} else {
558
char ascii_chars[128];
559
int c;
560
for (c = 0; c < 128; c++) {
561
ascii_chars[c] = c;
562
}
563
__Pyx_sys_getdefaultencoding_not_ascii = 1;
564
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
565
if (!ascii_chars_u) goto bad;
566
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
567
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
568
PyErr_Format(
569
PyExc_ValueError,
570
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
571
default_encoding_c);
572
goto bad;
573
}
574
Py_DECREF(ascii_chars_u);
575
Py_DECREF(ascii_chars_b);
576
}
577
Py_DECREF(default_encoding);
578
return 0;
579
bad:
580
Py_XDECREF(default_encoding);
581
Py_XDECREF(ascii_chars_u);
582
Py_XDECREF(ascii_chars_b);
583
return -1;
584
}
585
#endif
586
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
587
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
588
#else
589
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
590
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
591
static char* __PYX_DEFAULT_STRING_ENCODING;
592
static int __Pyx_init_sys_getdefaultencoding_params(void) {
593
PyObject* sys;
594
PyObject* default_encoding = NULL;
595
char* default_encoding_c;
596
sys = PyImport_ImportModule("sys");
597
if (!sys) goto bad;
598
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
599
Py_DECREF(sys);
600
if (!default_encoding) goto bad;
601
default_encoding_c = PyBytes_AsString(default_encoding);
602
if (!default_encoding_c) goto bad;
603
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
604
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
605
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
606
Py_DECREF(default_encoding);
607
return 0;
608
bad:
609
Py_XDECREF(default_encoding);
610
return -1;
611
}
612
#endif
613
#endif
614
615
616
/* Test for GCC > 2.95 */
617
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
618
#define likely(x) __builtin_expect(!!(x), 1)
619
#define unlikely(x) __builtin_expect(!!(x), 0)
620
#else /* !__GNUC__ or GCC < 2.95 */
621
#define likely(x) (x)
622
#define unlikely(x) (x)
623
#endif /* __GNUC__ */
624
625
static PyObject *__pyx_m;
626
static PyObject *__pyx_d;
627
static PyObject *__pyx_b;
628
static PyObject *__pyx_empty_tuple;
629
static PyObject *__pyx_empty_bytes;
630
static PyObject *__pyx_empty_unicode;
631
static int __pyx_lineno;
632
static int __pyx_clineno = 0;
633
static const char * __pyx_cfilenm= __FILE__;
634
static const char *__pyx_filename;
635
636
637
static const char *__pyx_f[] = {
638
"code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx",
639
"memory.pxd",
640
"sage_object.pxd",
641
"element.pxd",
642
"stdsage.pxd",
643
"code/alex/psage/psage/ellcurve/lseries/stringsource",
644
"type.pxd",
645
"bool.pxd",
646
"complex.pxd",
647
"category_object.pxd",
648
"coerce_dict.pxd",
649
"inherit_comparison.pxd",
650
"parent.pxd",
651
"parent_old.pxd",
652
"parent_base.pxd",
653
"parent_gens.pxd",
654
"ring.pxd",
655
"map.pxd",
656
"morphism.pxd",
657
"integer.pxd",
658
"binary_tree.pxd",
659
"polynomial_compiled.pxd",
660
"polynomial_element.pxd",
661
"ntl_ZZX.pxd",
662
"ntl_ZZ.pxd",
663
"number_field_element.pxd",
664
"number_field_element_quadratic.pxd",
665
"code/alex/psage/psage/modform/hilbert/sqrt5/sqrt5_fast.pxd",
666
"intlist.pxd",
667
"signals.pxi",
668
"stdsage.pxi",
669
"interrupt.pxi",
670
};
671
672
/*--- Type declarations ---*/
673
struct __pyx_obj_4sage_9structure_11sage_object_SageObject;
674
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject;
675
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict;
676
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict;
677
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass;
678
struct __pyx_obj_4sage_9structure_7element_Element;
679
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod;
680
struct __pyx_obj_4sage_9structure_7element_ModuleElement;
681
struct __pyx_obj_4sage_9structure_7element_MonoidElement;
682
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement;
683
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement;
684
struct __pyx_obj_4sage_9structure_7element_RingElement;
685
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement;
686
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement;
687
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement;
688
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement;
689
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement;
690
struct __pyx_obj_4sage_9structure_7element_FieldElement;
691
struct __pyx_obj_4sage_9structure_7element_AlgebraElement;
692
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement;
693
struct __pyx_obj_4sage_9structure_7element_InfinityElement;
694
struct __pyx_obj_4sage_9structure_7element_Vector;
695
struct __pyx_obj_4sage_9structure_7element_Matrix;
696
struct __pyx_obj_4sage_9structure_7element_CoercionModel;
697
struct __pyx_obj_4sage_9structure_6parent_Parent;
698
struct __pyx_obj_4sage_9structure_10parent_old_Parent;
699
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase;
700
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens;
701
struct __pyx_obj_4sage_5rings_4ring_Ring;
702
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing;
703
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain;
704
struct __pyx_obj_4sage_5rings_4ring_DedekindDomain;
705
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain;
706
struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain;
707
struct __pyx_obj_4sage_5rings_4ring_Field;
708
struct __pyx_obj_4sage_5rings_4ring_Algebra;
709
struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra;
710
struct __pyx_obj_4sage_10categories_3map_Map;
711
struct __pyx_obj_4sage_10categories_3map_Section;
712
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap;
713
struct __pyx_obj_4sage_10categories_8morphism_Morphism;
714
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism;
715
struct __pyx_obj_4sage_5rings_7integer_Integer;
716
struct __pyx_obj_4sage_5rings_7integer_int_to_Z;
717
struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree;
718
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction;
719
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd;
720
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd;
721
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd;
722
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd;
723
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd;
724
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd;
725
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd;
726
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd;
727
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd;
728
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd;
729
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd;
730
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd;
731
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial;
732
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense;
733
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact;
734
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX;
735
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ;
736
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement;
737
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute;
738
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative;
739
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute;
740
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative;
741
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic;
742
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic;
743
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract;
744
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement;
745
struct __pyx_obj_4sage_5stats_7intlist_IntList;
746
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius;
747
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator;
748
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py;
749
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce;
750
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action;
751
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action;
752
753
/* "sage/structure/parent.pxd":102
754
*
755
* # Flags for Parent.flags
756
* cdef enum: # <<<<<<<<<<<<<<
757
* # If this flag is set, call __richcmp__ on elements without
758
* # coercion. This allows a completely custom comparison function.
759
*/
760
enum {
761
__pyx_e_4sage_9structure_6parent_Parent_richcmp_element_without_coercion = 1
762
};
763
764
/* "sage/structure/parent.pxd":38
765
*
766
* # Called from the __init__ method to set up coercion.
767
* cdef int init_coerce(self, bint warn=*) except -1 # <<<<<<<<<<<<<<
768
*
769
* # returns whether or not there is a Morphism from S to self
770
*/
771
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce {
772
int __pyx_n;
773
int warn;
774
};
775
776
/* "sage/structure/parent.pxd":55
777
* # returns the Action by/on self on/by S
778
* # corresponding to op and self_on_left
779
* cpdef get_action(self, S, op=*, bint self_on_left=*, self_el=*, S_el=*) # <<<<<<<<<<<<<<
780
* cpdef _get_action_(self, S, op, bint self_on_left)
781
*
782
*/
783
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action {
784
int __pyx_n;
785
PyObject *op;
786
int self_on_left;
787
PyObject *self_el;
788
PyObject *S_el;
789
};
790
791
/* "sage/structure/parent.pxd":68
792
* cdef discover_coerce_map_from(self, S)
793
* cdef discover_convert_map_from(self, S)
794
* cdef discover_action(self, S, op, bint self_on_left, self_el=*, S_el=*) # <<<<<<<<<<<<<<
795
*
796
* # List consisting of Morphisms (from anything to self)
797
*/
798
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action {
799
int __pyx_n;
800
PyObject *self_el;
801
PyObject *S_el;
802
};
803
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args;
804
805
/* "map.pxd":15
806
* # these methods require x is an element of domain, and returns an element with parent codomain
807
* cpdef Element _call_(self, x)
808
* cpdef Element _call_with_args(self, x, args=*, kwds=*) # <<<<<<<<<<<<<<
809
*
810
* cdef public domain # will be either a weakref or a constant map
811
*/
812
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args {
813
int __pyx_n;
814
PyObject *args;
815
PyObject *kwds;
816
};
817
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node;
818
819
/* "sage/misc/binary_tree.pxd":1
820
* cdef struct binary_tree_node: # <<<<<<<<<<<<<<
821
* int key
822
* binary_tree_node *left
823
*/
824
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node {
825
int key;
826
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *left;
827
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *right;
828
void *value;
829
};
830
831
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":5
832
*
833
* # Residue element
834
* ctypedef long residue_element[2] # <<<<<<<<<<<<<<
835
*
836
* cdef class ResidueRingElement
837
*/
838
typedef long __pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element[2];
839
840
/* "sage/structure/sage_object.pxd":9
841
*
842
*
843
* cdef class SageObject: # <<<<<<<<<<<<<<
844
* pass
845
*
846
*/
847
struct __pyx_obj_4sage_9structure_11sage_object_SageObject {
848
PyObject_HEAD
849
};
850
851
852
/* "sage/structure/category_object.pxd":15
853
* cpdef check_default_category(default_category, category)
854
*
855
* cdef class CategoryObject(SageObject): # <<<<<<<<<<<<<<
856
* cdef public dict __cached_methods
857
* cdef _category
858
*/
859
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject {
860
struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
861
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtab;
862
PyObject *__cached_methods;
863
PyObject *_category;
864
PyObject *_base;
865
PyObject *_names;
866
PyObject *_factory_data;
867
PyObject *__weakref__;
868
long _hash_value;
869
};
870
871
872
/* "sage/structure/coerce_dict.pxd":7
873
*
874
* @cython.final
875
* cdef class MonoDict: # <<<<<<<<<<<<<<
876
* cdef __weakref__
877
* cdef size_t mask
878
*/
879
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict {
880
PyObject_HEAD
881
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtab;
882
PyObject *__weakref__;
883
size_t mask;
884
size_t used;
885
size_t fill;
886
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *table;
887
int weak_values;
888
PyObject *eraser;
889
};
890
891
892
/* "sage/structure/coerce_dict.pxd":23
893
*
894
* @cython.final
895
* cdef class TripleDict: # <<<<<<<<<<<<<<
896
* cdef __weakref__
897
* cdef size_t mask
898
*/
899
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict {
900
PyObject_HEAD
901
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtab;
902
PyObject *__weakref__;
903
size_t mask;
904
size_t used;
905
size_t fill;
906
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *table;
907
int weak_values;
908
PyObject *eraser;
909
};
910
911
912
/* "sage/misc/inherit_comparison.pxd":3
913
* cimport sage.misc.cython_metaclass
914
*
915
* cdef class InheritComparisonMetaclass(type): # <<<<<<<<<<<<<<
916
* pass
917
*/
918
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass {
919
PyHeapTypeObject __pyx_base;
920
};
921
922
923
/* "sage/structure/element.pxd":169
924
*
925
*
926
* cdef class Element(SageObject): # <<<<<<<<<<<<<<
927
* cdef Parent _parent
928
* cpdef _richcmp_(left, right, int op)
929
*/
930
struct __pyx_obj_4sage_9structure_7element_Element {
931
struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
932
struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtab;
933
struct __pyx_obj_4sage_9structure_6parent_Parent *_parent;
934
};
935
936
937
/* "sage/structure/element.pxd":192
938
*
939
*
940
* cdef class ElementWithCachedMethod(Element): # <<<<<<<<<<<<<<
941
* cdef public dict __cached_methods
942
*
943
*/
944
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod {
945
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
946
PyObject *__cached_methods;
947
};
948
949
950
/* "sage/structure/element.pxd":195
951
* cdef public dict __cached_methods
952
*
953
* cdef class ModuleElement(Element) # forward declaration # <<<<<<<<<<<<<<
954
*
955
* cdef class RingElement(ModuleElement) # forward declaration
956
*/
957
struct __pyx_obj_4sage_9structure_7element_ModuleElement {
958
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
959
};
960
961
962
/* "sage/structure/element.pxd":208
963
* cpdef _rmul_(self, RingElement left)
964
*
965
* cdef class MonoidElement(Element): # <<<<<<<<<<<<<<
966
* pass
967
*
968
*/
969
struct __pyx_obj_4sage_9structure_7element_MonoidElement {
970
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
971
};
972
973
974
/* "sage/structure/element.pxd":211
975
* pass
976
*
977
* cdef class MultiplicativeGroupElement(MonoidElement): # <<<<<<<<<<<<<<
978
* cpdef _div_(self, right)
979
*
980
*/
981
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement {
982
struct __pyx_obj_4sage_9structure_7element_MonoidElement __pyx_base;
983
};
984
985
986
/* "sage/structure/element.pxd":214
987
* cpdef _div_(self, right)
988
*
989
* cdef class AdditiveGroupElement(ModuleElement): # <<<<<<<<<<<<<<
990
* pass
991
*
992
*/
993
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement {
994
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
995
};
996
997
998
/* "sage/structure/element.pxd":197
999
* cdef class ModuleElement(Element) # forward declaration
1000
*
1001
* cdef class RingElement(ModuleElement) # forward declaration # <<<<<<<<<<<<<<
1002
*
1003
* cdef class ModuleElement(Element):
1004
*/
1005
struct __pyx_obj_4sage_9structure_7element_RingElement {
1006
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1007
};
1008
1009
1010
/* "sage/structure/element.pxd":220
1011
* cpdef _div_(self, right)
1012
*
1013
* cdef class CommutativeRingElement(RingElement): # <<<<<<<<<<<<<<
1014
* pass
1015
*
1016
*/
1017
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement {
1018
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1019
};
1020
1021
1022
/* "sage/structure/element.pxd":223
1023
* pass
1024
*
1025
* cdef class IntegralDomainElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1026
* pass
1027
*
1028
*/
1029
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement {
1030
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1031
};
1032
1033
1034
/* "sage/structure/element.pxd":226
1035
* pass
1036
*
1037
* cdef class DedekindDomainElement(IntegralDomainElement): # <<<<<<<<<<<<<<
1038
* pass
1039
*
1040
*/
1041
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement {
1042
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement __pyx_base;
1043
};
1044
1045
1046
/* "sage/structure/element.pxd":229
1047
* pass
1048
*
1049
* cdef class PrincipalIdealDomainElement(DedekindDomainElement): # <<<<<<<<<<<<<<
1050
* pass
1051
*
1052
*/
1053
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement {
1054
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement __pyx_base;
1055
};
1056
1057
1058
/* "sage/structure/element.pxd":232
1059
* pass
1060
*
1061
* cdef class EuclideanDomainElement(PrincipalIdealDomainElement): # <<<<<<<<<<<<<<
1062
* cpdef _floordiv_(self, right)
1063
* cpdef _mod_(self, right)
1064
*/
1065
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement {
1066
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
1067
};
1068
1069
1070
/* "sage/structure/element.pxd":236
1071
* cpdef _mod_(self, right)
1072
*
1073
* cdef class FieldElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1074
* cpdef _floordiv_(self, right)
1075
*
1076
*/
1077
struct __pyx_obj_4sage_9structure_7element_FieldElement {
1078
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1079
};
1080
1081
1082
/* "sage/structure/element.pxd":239
1083
* cpdef _floordiv_(self, right)
1084
*
1085
* cdef class AlgebraElement(RingElement): # <<<<<<<<<<<<<<
1086
* pass
1087
*
1088
*/
1089
struct __pyx_obj_4sage_9structure_7element_AlgebraElement {
1090
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1091
};
1092
1093
1094
/* "sage/structure/element.pxd":242
1095
* pass
1096
*
1097
* cdef class CommutativeAlgebraElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1098
* pass
1099
*
1100
*/
1101
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement {
1102
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1103
};
1104
1105
1106
/* "sage/structure/element.pxd":245
1107
* pass
1108
*
1109
* cdef class InfinityElement(RingElement): # <<<<<<<<<<<<<<
1110
* pass
1111
*
1112
*/
1113
struct __pyx_obj_4sage_9structure_7element_InfinityElement {
1114
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1115
};
1116
1117
1118
/* "sage/structure/element.pxd":249
1119
*
1120
*
1121
* cdef class Vector(ModuleElement): # <<<<<<<<<<<<<<
1122
* cdef Py_ssize_t _degree
1123
*
1124
*/
1125
struct __pyx_obj_4sage_9structure_7element_Vector {
1126
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1127
Py_ssize_t _degree;
1128
};
1129
1130
1131
/* "sage/structure/element.pxd":264
1132
*
1133
*
1134
* cdef class Matrix(ModuleElement): # <<<<<<<<<<<<<<
1135
* # All matrix classes must be written in Cython
1136
* cdef Py_ssize_t _nrows
1137
*/
1138
struct __pyx_obj_4sage_9structure_7element_Matrix {
1139
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1140
Py_ssize_t _nrows;
1141
Py_ssize_t _ncols;
1142
};
1143
1144
1145
/* "sage/structure/element.pxd":277
1146
*
1147
*
1148
* cdef class CoercionModel: # <<<<<<<<<<<<<<
1149
* cpdef canonical_coercion(self, x, y)
1150
* cpdef bin_op(self, x, y, op)
1151
*/
1152
struct __pyx_obj_4sage_9structure_7element_CoercionModel {
1153
PyObject_HEAD
1154
struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel *__pyx_vtab;
1155
};
1156
1157
1158
/* "sage/structure/parent.pxd":12
1159
* from sage.structure.coerce_dict cimport MonoDict, TripleDict
1160
*
1161
* cdef class Parent(category_object.CategoryObject): # <<<<<<<<<<<<<<
1162
* cdef public _element_constructor
1163
* cdef public _convert_method_name
1164
*/
1165
struct __pyx_obj_4sage_9structure_6parent_Parent {
1166
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject __pyx_base;
1167
PyObject *_element_constructor;
1168
PyObject *_convert_method_name;
1169
int _element_init_pass_parent;
1170
PyObject *_initial_coerce_list;
1171
PyObject *_initial_action_list;
1172
PyObject *_initial_convert_list;
1173
int _coercions_used;
1174
int flags;
1175
PyObject *_cache_an_element;
1176
PyObject *_coerce_from_list;
1177
PyObject *_registered_domains;
1178
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_coerce_from_hash;
1179
PyObject *_action_list;
1180
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *_action_hash;
1181
PyObject *_convert_from_list;
1182
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_convert_from_hash;
1183
PyObject *_embedding;
1184
};
1185
1186
1187
/* "parent_old.pxd":15
1188
*
1189
*
1190
* cdef class Parent(parent.Parent): # <<<<<<<<<<<<<<
1191
*
1192
* # returns a Morphism from S to self, or None
1193
*/
1194
struct __pyx_obj_4sage_9structure_10parent_old_Parent {
1195
struct __pyx_obj_4sage_9structure_6parent_Parent __pyx_base;
1196
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_has_coerce_map_from;
1197
};
1198
1199
1200
/* "parent_base.pxd":11
1201
* from .parent_old cimport Parent as Parent_old
1202
*
1203
* cdef class ParentWithBase(Parent_old): # <<<<<<<<<<<<<<
1204
* pass
1205
*/
1206
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase {
1207
struct __pyx_obj_4sage_9structure_10parent_old_Parent __pyx_base;
1208
};
1209
1210
1211
/* "sage/structure/parent_gens.pxd":18
1212
*
1213
*
1214
* cdef class ParentWithGens(ParentWithBase): # <<<<<<<<<<<<<<
1215
* cdef public object _gens
1216
* cdef public object _latex_names
1217
*/
1218
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens {
1219
struct __pyx_obj_4sage_9structure_11parent_base_ParentWithBase __pyx_base;
1220
PyObject *_gens;
1221
PyObject *_latex_names;
1222
PyObject *_list;
1223
};
1224
1225
1226
/* "sage/rings/ring.pxd":5
1227
* cpdef bint _is_Field(x) except -2
1228
*
1229
* cdef class Ring(ParentWithGens): # <<<<<<<<<<<<<<
1230
* cdef public object _zero_element
1231
* cdef public object _one_element
1232
*/
1233
struct __pyx_obj_4sage_5rings_4ring_Ring {
1234
struct __pyx_obj_4sage_9structure_11parent_gens_ParentWithGens __pyx_base;
1235
PyObject *_zero_element;
1236
PyObject *_one_element;
1237
PyObject *_zero_ideal;
1238
PyObject *_unit_ideal;
1239
PyObject *__ideal_monoid;
1240
};
1241
1242
1243
/* "sage/rings/ring.pxd":13
1244
* cdef _an_element_c_impl(self)
1245
*
1246
* cdef class CommutativeRing(Ring): # <<<<<<<<<<<<<<
1247
* cdef public object __fraction_field
1248
*
1249
*/
1250
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing {
1251
struct __pyx_obj_4sage_5rings_4ring_Ring __pyx_base;
1252
PyObject *__fraction_field;
1253
};
1254
1255
1256
/* "sage/rings/ring.pxd":16
1257
* cdef public object __fraction_field
1258
*
1259
* cdef class IntegralDomain(CommutativeRing): # <<<<<<<<<<<<<<
1260
* pass
1261
*
1262
*/
1263
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain {
1264
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
1265
};
1266
1267
1268
/* "sage/rings/ring.pxd":19
1269
* pass
1270
*
1271
* cdef class DedekindDomain(IntegralDomain): # <<<<<<<<<<<<<<
1272
* pass
1273
*
1274
*/
1275
struct __pyx_obj_4sage_5rings_4ring_DedekindDomain {
1276
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain __pyx_base;
1277
};
1278
1279
1280
/* "sage/rings/ring.pxd":23
1281
*
1282
*
1283
* cdef class PrincipalIdealDomain(IntegralDomain): # <<<<<<<<<<<<<<
1284
* pass
1285
*
1286
*/
1287
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain {
1288
struct __pyx_obj_4sage_5rings_4ring_IntegralDomain __pyx_base;
1289
};
1290
1291
1292
/* "sage/rings/ring.pxd":26
1293
* pass
1294
*
1295
* cdef class EuclideanDomain(PrincipalIdealDomain): # <<<<<<<<<<<<<<
1296
* pass
1297
*
1298
*/
1299
struct __pyx_obj_4sage_5rings_4ring_EuclideanDomain {
1300
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
1301
};
1302
1303
1304
/* "sage/rings/ring.pxd":29
1305
* pass
1306
*
1307
* cdef class Field(PrincipalIdealDomain): # <<<<<<<<<<<<<<
1308
* pass
1309
*
1310
*/
1311
struct __pyx_obj_4sage_5rings_4ring_Field {
1312
struct __pyx_obj_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
1313
};
1314
1315
1316
/* "sage/rings/ring.pxd":32
1317
* pass
1318
*
1319
* cdef class Algebra(Ring): # <<<<<<<<<<<<<<
1320
* pass
1321
*
1322
*/
1323
struct __pyx_obj_4sage_5rings_4ring_Algebra {
1324
struct __pyx_obj_4sage_5rings_4ring_Ring __pyx_base;
1325
};
1326
1327
1328
/* "sage/rings/ring.pxd":35
1329
* pass
1330
*
1331
* cdef class CommutativeAlgebra(CommutativeRing): # <<<<<<<<<<<<<<
1332
* pass
1333
*/
1334
struct __pyx_obj_4sage_5rings_4ring_CommutativeAlgebra {
1335
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
1336
};
1337
1338
1339
/* "map.pxd":4
1340
* from sage.structure.element cimport Element
1341
*
1342
* cdef class Map(Element): # <<<<<<<<<<<<<<
1343
* cdef object __weakref__
1344
*
1345
*/
1346
struct __pyx_obj_4sage_10categories_3map_Map {
1347
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
1348
PyObject *__weakref__;
1349
int _coerce_cost;
1350
PyObject *domain;
1351
PyObject *codomain;
1352
struct __pyx_obj_4sage_9structure_6parent_Parent *_codomain;
1353
PyObject *_category_for;
1354
PyObject *_repr_type_str;
1355
};
1356
1357
1358
/* "map.pxd":25
1359
*
1360
*
1361
* cdef class Section(Map): # <<<<<<<<<<<<<<
1362
* cdef Map _inverse
1363
*
1364
*/
1365
struct __pyx_obj_4sage_10categories_3map_Section {
1366
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1367
struct __pyx_obj_4sage_10categories_3map_Map *_inverse;
1368
};
1369
1370
1371
/* "map.pxd":28
1372
* cdef Map _inverse
1373
*
1374
* cdef class FormalCompositeMap(Map): # <<<<<<<<<<<<<<
1375
* cdef __list
1376
*/
1377
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap {
1378
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1379
PyObject *__pyx___list;
1380
};
1381
1382
1383
/* "sage/categories/morphism.pxd":5
1384
* from .map cimport Map
1385
*
1386
* cdef class Morphism(Map): # <<<<<<<<<<<<<<
1387
* pass
1388
*
1389
*/
1390
struct __pyx_obj_4sage_10categories_8morphism_Morphism {
1391
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1392
};
1393
1394
1395
/* "sage/categories/morphism.pxd":8
1396
* pass
1397
*
1398
* cdef class SetMorphism(Morphism): # <<<<<<<<<<<<<<
1399
* cdef object _function
1400
* cpdef bint _eq_c_impl(left, Element right)
1401
*/
1402
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism {
1403
struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
1404
PyObject *_function;
1405
};
1406
1407
1408
/* "sage/rings/integer.pxd":7
1409
* from sage.categories.morphism cimport Morphism
1410
*
1411
* cdef class Integer(EuclideanDomainElement): # <<<<<<<<<<<<<<
1412
* cdef mpz_t value
1413
*
1414
*/
1415
struct __pyx_obj_4sage_5rings_7integer_Integer {
1416
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
1417
mpz_t value;
1418
};
1419
1420
1421
/* "sage/rings/integer.pxd":37
1422
* cdef Integer smallInteger(long value)
1423
*
1424
* cdef class int_to_Z(Morphism): # <<<<<<<<<<<<<<
1425
* pass
1426
*/
1427
struct __pyx_obj_4sage_5rings_7integer_int_to_Z {
1428
struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
1429
};
1430
1431
1432
/* "sage/misc/binary_tree.pxd":27
1433
*
1434
*
1435
* cdef class BinaryTree: # <<<<<<<<<<<<<<
1436
* cdef binary_tree_node *head
1437
*/
1438
struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree {
1439
PyObject_HEAD
1440
struct __pyx_t_4sage_4misc_11binary_tree_binary_tree_node *head;
1441
};
1442
1443
1444
/* "polynomial_compiled.pxd":7
1445
* cdef class generic_pd
1446
*
1447
* cdef class CompiledPolynomialFunction: # <<<<<<<<<<<<<<
1448
* cdef generic_pd _dag
1449
* cdef object _coeffs
1450
*/
1451
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction {
1452
PyObject_HEAD
1453
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *__pyx_vtab;
1454
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *_dag;
1455
PyObject *_coeffs;
1456
};
1457
1458
1459
/* "polynomial_compiled.pxd":5
1460
*
1461
*
1462
* cdef class generic_pd # <<<<<<<<<<<<<<
1463
*
1464
* cdef class CompiledPolynomialFunction:
1465
*/
1466
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd {
1467
PyObject_HEAD
1468
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *__pyx_vtab;
1469
PyObject *value;
1470
int refs;
1471
int hits;
1472
int label;
1473
};
1474
1475
1476
/* "polynomial_compiled.pxd":24
1477
* cdef void reset(self)
1478
*
1479
* cdef class dummy_pd(generic_pd): # <<<<<<<<<<<<<<
1480
* cdef generic_pd link
1481
* cdef void fill(dummy_pd self, generic_pd link)
1482
*/
1483
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd {
1484
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1485
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *link;
1486
};
1487
1488
1489
/* "polynomial_compiled.pxd":28
1490
* cdef void fill(dummy_pd self, generic_pd link)
1491
*
1492
* cdef class var_pd(generic_pd): # <<<<<<<<<<<<<<
1493
* cdef int index
1494
*
1495
*/
1496
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_var_pd {
1497
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1498
int index;
1499
};
1500
1501
1502
/* "polynomial_compiled.pxd":31
1503
* cdef int index
1504
*
1505
* cdef class univar_pd(generic_pd): # <<<<<<<<<<<<<<
1506
* pass
1507
*
1508
*/
1509
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd {
1510
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1511
};
1512
1513
1514
/* "polynomial_compiled.pxd":34
1515
* pass
1516
*
1517
* cdef class coeff_pd(generic_pd): # <<<<<<<<<<<<<<
1518
* cdef int index
1519
*
1520
*/
1521
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd {
1522
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1523
int index;
1524
};
1525
1526
1527
/* "polynomial_compiled.pxd":38
1528
*
1529
*
1530
* cdef class unary_pd(generic_pd): # <<<<<<<<<<<<<<
1531
* cdef generic_pd operand
1532
*
1533
*/
1534
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd {
1535
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1536
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *operand;
1537
};
1538
1539
1540
/* "polynomial_compiled.pxd":41
1541
* cdef generic_pd operand
1542
*
1543
* cdef class sqr_pd(unary_pd): # <<<<<<<<<<<<<<
1544
* pass
1545
*
1546
*/
1547
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd {
1548
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
1549
};
1550
1551
1552
/* "polynomial_compiled.pxd":44
1553
* pass
1554
*
1555
* cdef class pow_pd(unary_pd): # <<<<<<<<<<<<<<
1556
* cdef object exponent
1557
*
1558
*/
1559
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd {
1560
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
1561
PyObject *exponent;
1562
};
1563
1564
1565
/* "polynomial_compiled.pxd":48
1566
*
1567
*
1568
* cdef class binary_pd(generic_pd): # <<<<<<<<<<<<<<
1569
* cdef generic_pd left, right
1570
*
1571
*/
1572
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd {
1573
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
1574
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *left;
1575
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *right;
1576
};
1577
1578
1579
/* "polynomial_compiled.pxd":51
1580
* cdef generic_pd left, right
1581
*
1582
* cdef class add_pd(binary_pd): # <<<<<<<<<<<<<<
1583
* pass
1584
*
1585
*/
1586
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_add_pd {
1587
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
1588
};
1589
1590
1591
/* "polynomial_compiled.pxd":54
1592
* pass
1593
*
1594
* cdef class mul_pd(binary_pd): # <<<<<<<<<<<<<<
1595
* pass
1596
*
1597
*/
1598
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd {
1599
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
1600
};
1601
1602
1603
/* "polynomial_compiled.pxd":57
1604
* pass
1605
*
1606
* cdef class abc_pd(binary_pd): # <<<<<<<<<<<<<<
1607
* cdef int index
1608
*
1609
*/
1610
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd {
1611
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
1612
int index;
1613
};
1614
1615
1616
/* "sage/rings/polynomial/polynomial_element.pxd":8
1617
*
1618
*
1619
* cdef class Polynomial(CommutativeAlgebraElement): # <<<<<<<<<<<<<<
1620
* cdef char _is_gen
1621
* cdef CompiledPolynomialFunction _compiled
1622
*/
1623
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial {
1624
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement __pyx_base;
1625
char _is_gen;
1626
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *_compiled;
1627
};
1628
1629
1630
/* "sage/rings/polynomial/polynomial_element.pxd":29
1631
* cdef get_unsafe(self, Py_ssize_t i)
1632
*
1633
* cdef class Polynomial_generic_dense(Polynomial): # <<<<<<<<<<<<<<
1634
* cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P)
1635
* cdef list __coeffs
1636
*/
1637
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense {
1638
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial __pyx_base;
1639
PyObject *__pyx___coeffs;
1640
};
1641
1642
1643
/* "sage/rings/polynomial/polynomial_element.pxd":34
1644
* cdef int __normalize(self) except -1
1645
*
1646
* cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense): # <<<<<<<<<<<<<<
1647
* pass
1648
*
1649
*/
1650
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact {
1651
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense __pyx_base;
1652
};
1653
1654
1655
/* "sage/libs/ntl/ntl_ZZX.pxd":3
1656
* from .types cimport ZZX_c
1657
*
1658
* cdef class ntl_ZZX(object): # <<<<<<<<<<<<<<
1659
* cdef ZZX_c x
1660
* cdef void setitem_from_int(ntl_ZZX self, long i, int value)
1661
*/
1662
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX {
1663
PyObject_HEAD
1664
struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx_vtab;
1665
ZZX x;
1666
};
1667
1668
1669
/* "sage/libs/ntl/ntl_ZZ.pxd":3
1670
* from sage.libs.ntl.types cimport ZZ_c
1671
*
1672
* cdef class ntl_ZZ(object): # <<<<<<<<<<<<<<
1673
* cdef ZZ_c x
1674
* cdef int get_as_int(ntl_ZZ self)
1675
*/
1676
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ {
1677
PyObject_HEAD
1678
struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx_vtab;
1679
ZZ x;
1680
};
1681
1682
1683
/* "number_field_element.pxd":11
1684
* from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
1685
*
1686
* cdef class NumberFieldElement(FieldElement): # <<<<<<<<<<<<<<
1687
* cdef ZZX_c __numerator
1688
* cdef ZZ_c __denominator
1689
*/
1690
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement {
1691
struct __pyx_obj_4sage_9structure_7element_FieldElement __pyx_base;
1692
ZZX __pyx___numerator;
1693
ZZ __pyx___denominator;
1694
struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx___fld_numerator;
1695
struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx___fld_denominator;
1696
PyObject *__pyx___multiplicative_order;
1697
PyObject *__pyx___pari;
1698
PyObject *__pyx___matrix;
1699
};
1700
1701
1702
/* "number_field_element.pxd":38
1703
*
1704
*
1705
* cdef class NumberFieldElement_absolute(NumberFieldElement): # <<<<<<<<<<<<<<
1706
* pass
1707
*
1708
*/
1709
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute {
1710
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
1711
};
1712
1713
1714
/* "number_field_element.pxd":41
1715
* pass
1716
*
1717
* cdef class NumberFieldElement_relative(NumberFieldElement): # <<<<<<<<<<<<<<
1718
* pass
1719
*
1720
*/
1721
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative {
1722
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
1723
};
1724
1725
1726
/* "number_field_element.pxd":46
1727
* # TODO: cyclotomic and/or quadratic classes? (Both for differing implementations and speed).
1728
*
1729
* cdef class OrderElement_absolute(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
1730
* cdef object _number_field
1731
*
1732
*/
1733
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute {
1734
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
1735
PyObject *_number_field;
1736
};
1737
1738
1739
/* "number_field_element.pxd":49
1740
* cdef object _number_field
1741
*
1742
* cdef class OrderElement_relative(NumberFieldElement_relative): # <<<<<<<<<<<<<<
1743
* cdef object _number_field
1744
*/
1745
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_OrderElement_relative {
1746
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative __pyx_base;
1747
PyObject *_number_field;
1748
};
1749
1750
1751
/* "sage/rings/number_field/number_field_element_quadratic.pxd":6
1752
*
1753
*
1754
* cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
1755
* # (a + b sqrt(D)) / denom
1756
* cdef mpz_t a, b, denom
1757
*/
1758
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic {
1759
struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
1760
mpz_t a;
1761
mpz_t b;
1762
mpz_t denom;
1763
struct __pyx_obj_4sage_5rings_7integer_Integer *D;
1764
int standard_embedding;
1765
};
1766
1767
1768
/* "sage/rings/number_field/number_field_element_quadratic.pxd":19
1769
*
1770
*
1771
* cdef class OrderElement_quadratic(NumberFieldElement_quadratic): # <<<<<<<<<<<<<<
1772
* pass
1773
*/
1774
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic {
1775
struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic __pyx_base;
1776
};
1777
1778
1779
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":9
1780
* cdef class ResidueRingElement
1781
*
1782
* cdef class ResidueRing_abstract(CommutativeRing): # <<<<<<<<<<<<<<
1783
* cdef object P, F
1784
* cdef public object element_class, _residue_field
1785
*/
1786
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract {
1787
struct __pyx_obj_4sage_5rings_4ring_CommutativeRing __pyx_base;
1788
PyObject *P;
1789
PyObject *F;
1790
PyObject *element_class;
1791
PyObject *_residue_field;
1792
long n0;
1793
long n1;
1794
long p;
1795
long e;
1796
long _cardinality;
1797
long im_gen0;
1798
};
1799
1800
1801
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":7
1802
* ctypedef long residue_element[2]
1803
*
1804
* cdef class ResidueRingElement # <<<<<<<<<<<<<<
1805
*
1806
* cdef class ResidueRing_abstract(CommutativeRing):
1807
*/
1808
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement {
1809
PyObject_HEAD
1810
struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_vtab;
1811
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element x;
1812
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *_parent;
1813
};
1814
1815
1816
/* "sage/stats/intlist.pxd":8
1817
* #############################################################################
1818
*
1819
* cdef class IntList: # <<<<<<<<<<<<<<
1820
* cdef int* _values
1821
* cdef Py_ssize_t _length
1822
*/
1823
struct __pyx_obj_4sage_5stats_7intlist_IntList {
1824
PyObject_HEAD
1825
struct __pyx_vtabstruct_4sage_5stats_7intlist_IntList *__pyx_vtab;
1826
int *_values;
1827
Py_ssize_t _length;
1828
};
1829
1830
1831
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":123
1832
* cdef long UNKNOWN = 2**31 - 1
1833
*
1834
* cdef class TracesOfFrobenius: # <<<<<<<<<<<<<<
1835
* cdef long bound, table_size
1836
* cdef long* primes
1837
*/
1838
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius {
1839
PyObject_HEAD
1840
long bound;
1841
long table_size;
1842
long *primes;
1843
long *sqrt5;
1844
long *ap;
1845
mpz_t Ax;
1846
mpz_t Ay;
1847
mpz_t Bx;
1848
mpz_t By;
1849
PyObject *E;
1850
PyObject *j;
1851
PyObject *c_quo;
1852
};
1853
1854
1855
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":365
1856
* return C
1857
*
1858
* cdef class InertTraceCalculator: # <<<<<<<<<<<<<<
1859
* cdef public dict tables
1860
*
1861
*/
1862
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator {
1863
PyObject_HEAD
1864
struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_vtab;
1865
PyObject *tables;
1866
};
1867
1868
1869
/* "cfunc.to_py":64
1870
*
1871
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
1872
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
1873
* def wrap(object arg0, object arg1, int arg2):
1874
* """wrap(arg0, arg1, arg2: 'int')"""
1875
*/
1876
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py {
1877
PyObject_HEAD
1878
PyObject *(*__pyx_v_f)(PyObject *, PyObject *, int);
1879
};
1880
1881
1882
1883
/* "sage/structure/category_object.pxd":15
1884
* cpdef check_default_category(default_category, category)
1885
*
1886
* cdef class CategoryObject(SageObject): # <<<<<<<<<<<<<<
1887
* cdef public dict __cached_methods
1888
* cdef _category
1889
*/
1890
1891
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject {
1892
PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject *, PyObject *);
1893
};
1894
static struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject;
1895
1896
1897
/* "sage/structure/coerce_dict.pxd":7
1898
*
1899
* @cython.final
1900
* cdef class MonoDict: # <<<<<<<<<<<<<<
1901
* cdef __weakref__
1902
* cdef size_t mask
1903
*/
1904
1905
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict {
1906
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
1907
PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
1908
PyObject *(*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *, PyObject *);
1909
int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *);
1910
};
1911
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict;
1912
1913
1914
/* "sage/structure/coerce_dict.pxd":23
1915
*
1916
* @cython.final
1917
* cdef class TripleDict: # <<<<<<<<<<<<<<
1918
* cdef __weakref__
1919
* cdef size_t mask
1920
*/
1921
1922
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict {
1923
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
1924
PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
1925
PyObject *(*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *, PyObject *);
1926
int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *);
1927
};
1928
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict;
1929
1930
1931
/* "sage/structure/element.pxd":169
1932
*
1933
*
1934
* cdef class Element(SageObject): # <<<<<<<<<<<<<<
1935
* cdef Parent _parent
1936
* cpdef _richcmp_(left, right, int op)
1937
*/
1938
1939
struct __pyx_vtabstruct_4sage_9structure_7element_Element {
1940
PyObject *(*_richcmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1941
int (*_cmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
1942
PyObject *(*base_extend)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
1943
PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1944
PyObject *(*_act_on_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1945
PyObject *(*_acted_upon_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1946
PyObject *(*_add_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1947
PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1948
PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_Element *);
1949
PyObject *(*_add_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
1950
PyObject *(*_mul_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1951
PyObject *(*_mul_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
1952
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1953
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1954
PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1955
};
1956
static struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtabptr_4sage_9structure_7element_Element;
1957
1958
1959
/* "sage/structure/element.pxd":192
1960
*
1961
*
1962
* cdef class ElementWithCachedMethod(Element): # <<<<<<<<<<<<<<
1963
* cdef public dict __cached_methods
1964
*
1965
*/
1966
1967
struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod {
1968
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1969
};
1970
static struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod *__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod;
1971
1972
1973
/* "sage/structure/element.pxd":195
1974
* cdef public dict __cached_methods
1975
*
1976
* cdef class ModuleElement(Element) # forward declaration # <<<<<<<<<<<<<<
1977
*
1978
* cdef class RingElement(ModuleElement) # forward declaration
1979
*/
1980
1981
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement {
1982
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1983
PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, PyObject *, int __pyx_skip_dispatch);
1984
PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, int __pyx_skip_dispatch);
1985
PyObject *(*_lmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_RingElement *, int __pyx_skip_dispatch);
1986
PyObject *(*_rmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_RingElement *, int __pyx_skip_dispatch);
1987
};
1988
static struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement *__pyx_vtabptr_4sage_9structure_7element_ModuleElement;
1989
1990
1991
/* "sage/structure/element.pxd":197
1992
* cdef class ModuleElement(Element) # forward declaration
1993
*
1994
* cdef class RingElement(ModuleElement) # forward declaration # <<<<<<<<<<<<<<
1995
*
1996
* cdef class ModuleElement(Element):
1997
*/
1998
1999
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement {
2000
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2001
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_RingElement *, PyObject *, int __pyx_skip_dispatch);
2002
};
2003
static struct __pyx_vtabstruct_4sage_9structure_7element_RingElement *__pyx_vtabptr_4sage_9structure_7element_RingElement;
2004
2005
2006
/* "sage/structure/element.pxd":208
2007
* cpdef _rmul_(self, RingElement left)
2008
*
2009
* cdef class MonoidElement(Element): # <<<<<<<<<<<<<<
2010
* pass
2011
*
2012
*/
2013
2014
struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement {
2015
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
2016
};
2017
static struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement *__pyx_vtabptr_4sage_9structure_7element_MonoidElement;
2018
2019
2020
/* "sage/structure/element.pxd":211
2021
* pass
2022
*
2023
* cdef class MultiplicativeGroupElement(MonoidElement): # <<<<<<<<<<<<<<
2024
* cpdef _div_(self, right)
2025
*
2026
*/
2027
2028
struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement {
2029
struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement __pyx_base;
2030
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement *, PyObject *, int __pyx_skip_dispatch);
2031
};
2032
static struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement *__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement;
2033
2034
2035
/* "sage/structure/element.pxd":214
2036
* cpdef _div_(self, right)
2037
*
2038
* cdef class AdditiveGroupElement(ModuleElement): # <<<<<<<<<<<<<<
2039
* pass
2040
*
2041
*/
2042
2043
struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement {
2044
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2045
};
2046
static struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement *__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement;
2047
2048
2049
/* "sage/structure/element.pxd":220
2050
* cpdef _div_(self, right)
2051
*
2052
* cdef class CommutativeRingElement(RingElement): # <<<<<<<<<<<<<<
2053
* pass
2054
*
2055
*/
2056
2057
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement {
2058
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
2059
};
2060
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement;
2061
2062
2063
/* "sage/structure/element.pxd":223
2064
* pass
2065
*
2066
* cdef class IntegralDomainElement(CommutativeRingElement): # <<<<<<<<<<<<<<
2067
* pass
2068
*
2069
*/
2070
2071
struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement {
2072
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
2073
};
2074
static struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement *__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement;
2075
2076
2077
/* "sage/structure/element.pxd":226
2078
* pass
2079
*
2080
* cdef class DedekindDomainElement(IntegralDomainElement): # <<<<<<<<<<<<<<
2081
* pass
2082
*
2083
*/
2084
2085
struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement {
2086
struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement __pyx_base;
2087
};
2088
static struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement *__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement;
2089
2090
2091
/* "sage/structure/element.pxd":229
2092
* pass
2093
*
2094
* cdef class PrincipalIdealDomainElement(DedekindDomainElement): # <<<<<<<<<<<<<<
2095
* pass
2096
*
2097
*/
2098
2099
struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement {
2100
struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement __pyx_base;
2101
};
2102
static struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement *__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement;
2103
2104
2105
/* "sage/structure/element.pxd":232
2106
* pass
2107
*
2108
* cdef class EuclideanDomainElement(PrincipalIdealDomainElement): # <<<<<<<<<<<<<<
2109
* cpdef _floordiv_(self, right)
2110
* cpdef _mod_(self, right)
2111
*/
2112
2113
struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement {
2114
struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
2115
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
2116
PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
2117
};
2118
static struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement *__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement;
2119
2120
2121
/* "sage/structure/element.pxd":236
2122
* cpdef _mod_(self, right)
2123
*
2124
* cdef class FieldElement(CommutativeRingElement): # <<<<<<<<<<<<<<
2125
* cpdef _floordiv_(self, right)
2126
*
2127
*/
2128
2129
struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement {
2130
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
2131
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_FieldElement *, PyObject *, int __pyx_skip_dispatch);
2132
};
2133
static struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement *__pyx_vtabptr_4sage_9structure_7element_FieldElement;
2134
2135
2136
/* "sage/structure/element.pxd":239
2137
* cpdef _floordiv_(self, right)
2138
*
2139
* cdef class AlgebraElement(RingElement): # <<<<<<<<<<<<<<
2140
* pass
2141
*
2142
*/
2143
2144
struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement {
2145
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
2146
};
2147
static struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement *__pyx_vtabptr_4sage_9structure_7element_AlgebraElement;
2148
2149
2150
/* "sage/structure/element.pxd":242
2151
* pass
2152
*
2153
* cdef class CommutativeAlgebraElement(CommutativeRingElement): # <<<<<<<<<<<<<<
2154
* pass
2155
*
2156
*/
2157
2158
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement {
2159
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
2160
};
2161
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement;
2162
2163
2164
/* "sage/structure/element.pxd":245
2165
* pass
2166
*
2167
* cdef class InfinityElement(RingElement): # <<<<<<<<<<<<<<
2168
* pass
2169
*
2170
*/
2171
2172
struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement {
2173
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
2174
};
2175
static struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement *__pyx_vtabptr_4sage_9structure_7element_InfinityElement;
2176
2177
2178
/* "sage/structure/element.pxd":249
2179
*
2180
*
2181
* cdef class Vector(ModuleElement): # <<<<<<<<<<<<<<
2182
* cdef Py_ssize_t _degree
2183
*
2184
*/
2185
2186
struct __pyx_vtabstruct_4sage_9structure_7element_Vector {
2187
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2188
PyObject *(*_dot_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
2189
PyObject *(*_dot_product_coerce_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
2190
PyObject *(*_pairwise_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
2191
int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
2192
int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
2193
};
2194
static struct __pyx_vtabstruct_4sage_9structure_7element_Vector *__pyx_vtabptr_4sage_9structure_7element_Vector;
2195
2196
2197
/* "sage/structure/element.pxd":264
2198
*
2199
*
2200
* cdef class Matrix(ModuleElement): # <<<<<<<<<<<<<<
2201
* # All matrix classes must be written in Cython
2202
* cdef Py_ssize_t _nrows
2203
*/
2204
2205
struct __pyx_vtabstruct_4sage_9structure_7element_Matrix {
2206
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
2207
PyObject *(*_vector_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
2208
PyObject *(*_matrix_times_vector_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
2209
PyObject *(*_matrix_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Matrix *);
2210
int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
2211
int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
2212
};
2213
static struct __pyx_vtabstruct_4sage_9structure_7element_Matrix *__pyx_vtabptr_4sage_9structure_7element_Matrix;
2214
2215
2216
/* "sage/structure/element.pxd":277
2217
*
2218
*
2219
* cdef class CoercionModel: # <<<<<<<<<<<<<<
2220
* cpdef canonical_coercion(self, x, y)
2221
* cpdef bin_op(self, x, y, op)
2222
*/
2223
2224
struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel {
2225
PyObject *(*canonical_coercion)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, int __pyx_skip_dispatch);
2226
PyObject *(*bin_op)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
2227
PyObject *(*richcmp)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
2228
};
2229
static struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel *__pyx_vtabptr_4sage_9structure_7element_CoercionModel;
2230
2231
2232
/* "sage/structure/parent.pxd":12
2233
* from sage.structure.coerce_dict cimport MonoDict, TripleDict
2234
*
2235
* cdef class Parent(category_object.CategoryObject): # <<<<<<<<<<<<<<
2236
* cdef public _element_constructor
2237
* cdef public _convert_method_name
2238
*/
2239
2240
struct __pyx_vtabstruct_4sage_9structure_6parent_Parent {
2241
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject __pyx_base;
2242
int (*get_flag)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
2243
int (*is_coercion_cached)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2244
int (*is_conversion_cached)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2245
PyObject *(*register_coercion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2246
PyObject *(*register_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2247
PyObject *(*register_conversion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2248
PyObject *(*register_embedding)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2249
int (*_richcmp)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int, int __pyx_skip_dispatch);
2250
int (*_cmp_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2251
int (*is_exact)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
2252
int (*init_coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce *__pyx_optional_args);
2253
int (*has_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2254
PyObject *(*coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2255
PyObject *(*_internal_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2256
PyObject *(*_coerce_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2257
PyObject *(*convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2258
PyObject *(*_internal_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2259
PyObject *(*_convert_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2260
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);
2261
PyObject *(*_get_action_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
2262
PyObject *(*coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2263
PyObject *(*an_element)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
2264
PyObject *(*_generic_convert_map)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
2265
PyObject *(*discover_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
2266
PyObject *(*discover_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
2267
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);
2268
};
2269
static struct __pyx_vtabstruct_4sage_9structure_6parent_Parent *__pyx_vtabptr_4sage_9structure_6parent_Parent;
2270
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
2271
2272
2273
/* "parent_old.pxd":15
2274
*
2275
*
2276
* cdef class Parent(parent.Parent): # <<<<<<<<<<<<<<
2277
*
2278
* # returns a Morphism from S to self, or None
2279
*/
2280
2281
struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent {
2282
struct __pyx_vtabstruct_4sage_9structure_6parent_Parent __pyx_base;
2283
PyObject *(*coerce_map_from_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
2284
PyObject *(*coerce_map_from_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
2285
PyObject *(*get_action_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
2286
PyObject *(*get_action_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, PyObject *, int);
2287
PyObject *(*has_coerce_map_from_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
2288
PyObject *(*has_coerce_map_from_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
2289
PyObject *(*_coerce_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *, int __pyx_skip_dispatch);
2290
PyObject *(*_coerce_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, PyObject *);
2291
PyObject *(*_an_element_c_impl)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *);
2292
PyObject *(*_an_element_c)(struct __pyx_obj_4sage_9structure_10parent_old_Parent *, int __pyx_skip_dispatch);
2293
};
2294
static struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent *__pyx_vtabptr_4sage_9structure_10parent_old_Parent;
2295
2296
2297
/* "parent_base.pxd":11
2298
* from .parent_old cimport Parent as Parent_old
2299
*
2300
* cdef class ParentWithBase(Parent_old): # <<<<<<<<<<<<<<
2301
* pass
2302
*/
2303
2304
struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase {
2305
struct __pyx_vtabstruct_4sage_9structure_10parent_old_Parent __pyx_base;
2306
};
2307
static struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase *__pyx_vtabptr_4sage_9structure_11parent_base_ParentWithBase;
2308
2309
2310
/* "sage/structure/parent_gens.pxd":18
2311
*
2312
*
2313
* cdef class ParentWithGens(ParentWithBase): # <<<<<<<<<<<<<<
2314
* cdef public object _gens
2315
* cdef public object _latex_names
2316
*/
2317
2318
struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens {
2319
struct __pyx_vtabstruct_4sage_9structure_11parent_base_ParentWithBase __pyx_base;
2320
};
2321
static struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens *__pyx_vtabptr_4sage_9structure_11parent_gens_ParentWithGens;
2322
2323
2324
/* "sage/rings/ring.pxd":5
2325
* cpdef bint _is_Field(x) except -2
2326
*
2327
* cdef class Ring(ParentWithGens): # <<<<<<<<<<<<<<
2328
* cdef public object _zero_element
2329
* cdef public object _one_element
2330
*/
2331
2332
struct __pyx_vtabstruct_4sage_5rings_4ring_Ring {
2333
struct __pyx_vtabstruct_4sage_9structure_11parent_gens_ParentWithGens __pyx_base;
2334
};
2335
static struct __pyx_vtabstruct_4sage_5rings_4ring_Ring *__pyx_vtabptr_4sage_5rings_4ring_Ring;
2336
2337
2338
/* "sage/rings/ring.pxd":13
2339
* cdef _an_element_c_impl(self)
2340
*
2341
* cdef class CommutativeRing(Ring): # <<<<<<<<<<<<<<
2342
* cdef public object __fraction_field
2343
*
2344
*/
2345
2346
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing {
2347
struct __pyx_vtabstruct_4sage_5rings_4ring_Ring __pyx_base;
2348
};
2349
static struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing *__pyx_vtabptr_4sage_5rings_4ring_CommutativeRing;
2350
2351
2352
/* "sage/rings/ring.pxd":16
2353
* cdef public object __fraction_field
2354
*
2355
* cdef class IntegralDomain(CommutativeRing): # <<<<<<<<<<<<<<
2356
* pass
2357
*
2358
*/
2359
2360
struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain {
2361
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
2362
};
2363
static struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain *__pyx_vtabptr_4sage_5rings_4ring_IntegralDomain;
2364
2365
2366
/* "sage/rings/ring.pxd":19
2367
* pass
2368
*
2369
* cdef class DedekindDomain(IntegralDomain): # <<<<<<<<<<<<<<
2370
* pass
2371
*
2372
*/
2373
2374
struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain {
2375
struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain __pyx_base;
2376
};
2377
static struct __pyx_vtabstruct_4sage_5rings_4ring_DedekindDomain *__pyx_vtabptr_4sage_5rings_4ring_DedekindDomain;
2378
2379
2380
/* "sage/rings/ring.pxd":23
2381
*
2382
*
2383
* cdef class PrincipalIdealDomain(IntegralDomain): # <<<<<<<<<<<<<<
2384
* pass
2385
*
2386
*/
2387
2388
struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain {
2389
struct __pyx_vtabstruct_4sage_5rings_4ring_IntegralDomain __pyx_base;
2390
};
2391
static struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain *__pyx_vtabptr_4sage_5rings_4ring_PrincipalIdealDomain;
2392
2393
2394
/* "sage/rings/ring.pxd":26
2395
* pass
2396
*
2397
* cdef class EuclideanDomain(PrincipalIdealDomain): # <<<<<<<<<<<<<<
2398
* pass
2399
*
2400
*/
2401
2402
struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain {
2403
struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
2404
};
2405
static struct __pyx_vtabstruct_4sage_5rings_4ring_EuclideanDomain *__pyx_vtabptr_4sage_5rings_4ring_EuclideanDomain;
2406
2407
2408
/* "sage/rings/ring.pxd":29
2409
* pass
2410
*
2411
* cdef class Field(PrincipalIdealDomain): # <<<<<<<<<<<<<<
2412
* pass
2413
*
2414
*/
2415
2416
struct __pyx_vtabstruct_4sage_5rings_4ring_Field {
2417
struct __pyx_vtabstruct_4sage_5rings_4ring_PrincipalIdealDomain __pyx_base;
2418
};
2419
static struct __pyx_vtabstruct_4sage_5rings_4ring_Field *__pyx_vtabptr_4sage_5rings_4ring_Field;
2420
2421
2422
/* "sage/rings/ring.pxd":32
2423
* pass
2424
*
2425
* cdef class Algebra(Ring): # <<<<<<<<<<<<<<
2426
* pass
2427
*
2428
*/
2429
2430
struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra {
2431
struct __pyx_vtabstruct_4sage_5rings_4ring_Ring __pyx_base;
2432
};
2433
static struct __pyx_vtabstruct_4sage_5rings_4ring_Algebra *__pyx_vtabptr_4sage_5rings_4ring_Algebra;
2434
2435
2436
/* "sage/rings/ring.pxd":35
2437
* pass
2438
*
2439
* cdef class CommutativeAlgebra(CommutativeRing): # <<<<<<<<<<<<<<
2440
* pass
2441
*/
2442
2443
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra {
2444
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
2445
};
2446
static struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeAlgebra *__pyx_vtabptr_4sage_5rings_4ring_CommutativeAlgebra;
2447
2448
2449
/* "map.pxd":4
2450
* from sage.structure.element cimport Element
2451
*
2452
* cdef class Map(Element): # <<<<<<<<<<<<<<
2453
* cdef object __weakref__
2454
*
2455
*/
2456
2457
struct __pyx_vtabstruct_4sage_10categories_3map_Map {
2458
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
2459
PyObject *(*_update_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
2460
PyObject *(*_extra_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
2461
struct __pyx_obj_4sage_9structure_7element_Element *(*_call_)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch);
2462
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);
2463
};
2464
static struct __pyx_vtabstruct_4sage_10categories_3map_Map *__pyx_vtabptr_4sage_10categories_3map_Map;
2465
2466
2467
/* "map.pxd":25
2468
*
2469
*
2470
* cdef class Section(Map): # <<<<<<<<<<<<<<
2471
* cdef Map _inverse
2472
*
2473
*/
2474
2475
struct __pyx_vtabstruct_4sage_10categories_3map_Section {
2476
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
2477
};
2478
static struct __pyx_vtabstruct_4sage_10categories_3map_Section *__pyx_vtabptr_4sage_10categories_3map_Section;
2479
2480
2481
/* "map.pxd":28
2482
* cdef Map _inverse
2483
*
2484
* cdef class FormalCompositeMap(Map): # <<<<<<<<<<<<<<
2485
* cdef __list
2486
*/
2487
2488
struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap {
2489
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
2490
};
2491
static struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap *__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap;
2492
2493
2494
/* "sage/categories/morphism.pxd":5
2495
* from .map cimport Map
2496
*
2497
* cdef class Morphism(Map): # <<<<<<<<<<<<<<
2498
* pass
2499
*
2500
*/
2501
2502
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism {
2503
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
2504
};
2505
static struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism *__pyx_vtabptr_4sage_10categories_8morphism_Morphism;
2506
2507
2508
/* "sage/categories/morphism.pxd":8
2509
* pass
2510
*
2511
* cdef class SetMorphism(Morphism): # <<<<<<<<<<<<<<
2512
* cdef object _function
2513
* cpdef bint _eq_c_impl(left, Element right)
2514
*/
2515
2516
struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism {
2517
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
2518
int (*_eq_c_impl)(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism *, struct __pyx_obj_4sage_9structure_7element_Element *, int __pyx_skip_dispatch);
2519
};
2520
static struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism *__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism;
2521
2522
2523
/* "sage/rings/integer.pxd":7
2524
* from sage.categories.morphism cimport Morphism
2525
*
2526
* cdef class Integer(EuclideanDomainElement): # <<<<<<<<<<<<<<
2527
* cdef mpz_t value
2528
*
2529
*/
2530
2531
struct __pyx_vtabstruct_4sage_5rings_7integer_Integer {
2532
struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
2533
int (*_to_ZZ)(struct __pyx_obj_4sage_5rings_7integer_Integer *, ZZ *);
2534
void (*set_from_mpz)(struct __pyx_obj_4sage_5rings_7integer_Integer *, __mpz_struct *);
2535
PyObject *(*hash_c)(struct __pyx_obj_4sage_5rings_7integer_Integer *);
2536
PyObject *(*_pari_)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2537
PyObject *(*_shift_helper)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int, int __pyx_skip_dispatch);
2538
PyObject *(*_and)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2539
PyObject *(*_or)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2540
PyObject *(*_xor)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2541
size_t (*_exact_log_log2_iter)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2542
size_t (*_exact_log_mpfi_log)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int __pyx_skip_dispatch);
2543
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);
2544
PyObject *(*_val_unit)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2545
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 *);
2546
int (*_is_power_of)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
2547
int (*_pseudoprime_is_prime)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
2548
PyObject *(*_pari_divisors_small)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
2549
PyObject *(*_reduce_set)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
2550
};
2551
static struct __pyx_vtabstruct_4sage_5rings_7integer_Integer *__pyx_vtabptr_4sage_5rings_7integer_Integer;
2552
2553
2554
/* "sage/rings/integer.pxd":37
2555
* cdef Integer smallInteger(long value)
2556
*
2557
* cdef class int_to_Z(Morphism): # <<<<<<<<<<<<<<
2558
* pass
2559
*/
2560
2561
struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z {
2562
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
2563
};
2564
static struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z *__pyx_vtabptr_4sage_5rings_7integer_int_to_Z;
2565
2566
2567
/* "polynomial_compiled.pxd":5
2568
*
2569
*
2570
* cdef class generic_pd # <<<<<<<<<<<<<<
2571
*
2572
* cdef class CompiledPolynomialFunction:
2573
*/
2574
2575
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd {
2576
int (*eval)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *, PyObject *, PyObject *);
2577
struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *(*nodummies)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
2578
void (*reset)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
2579
};
2580
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd;
2581
2582
2583
/* "polynomial_compiled.pxd":7
2584
* cdef class generic_pd
2585
*
2586
* cdef class CompiledPolynomialFunction: # <<<<<<<<<<<<<<
2587
* cdef generic_pd _dag
2588
* cdef object _coeffs
2589
*/
2590
2591
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction {
2592
PyObject *(*_parse_structure)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *);
2593
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);
2594
void (*_fill_gaps_binary)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, struct __pyx_obj_4sage_4misc_11binary_tree_BinaryTree *);
2595
PyObject *(*eval)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *, PyObject *);
2596
};
2597
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction;
2598
2599
2600
/* "polynomial_compiled.pxd":24
2601
* cdef void reset(self)
2602
*
2603
* cdef class dummy_pd(generic_pd): # <<<<<<<<<<<<<<
2604
* cdef generic_pd link
2605
* cdef void fill(dummy_pd self, generic_pd link)
2606
*/
2607
2608
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd {
2609
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2610
void (*fill)(struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd *, struct __pyx_obj_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd *);
2611
};
2612
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd;
2613
2614
2615
/* "polynomial_compiled.pxd":28
2616
* cdef void fill(dummy_pd self, generic_pd link)
2617
*
2618
* cdef class var_pd(generic_pd): # <<<<<<<<<<<<<<
2619
* cdef int index
2620
*
2621
*/
2622
2623
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd {
2624
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2625
};
2626
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_var_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_var_pd;
2627
2628
2629
/* "polynomial_compiled.pxd":31
2630
* cdef int index
2631
*
2632
* cdef class univar_pd(generic_pd): # <<<<<<<<<<<<<<
2633
* pass
2634
*
2635
*/
2636
2637
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd {
2638
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2639
};
2640
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd;
2641
2642
2643
/* "polynomial_compiled.pxd":34
2644
* pass
2645
*
2646
* cdef class coeff_pd(generic_pd): # <<<<<<<<<<<<<<
2647
* cdef int index
2648
*
2649
*/
2650
2651
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd {
2652
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2653
};
2654
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd;
2655
2656
2657
/* "polynomial_compiled.pxd":38
2658
*
2659
*
2660
* cdef class unary_pd(generic_pd): # <<<<<<<<<<<<<<
2661
* cdef generic_pd operand
2662
*
2663
*/
2664
2665
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd {
2666
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2667
};
2668
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd;
2669
2670
2671
/* "polynomial_compiled.pxd":41
2672
* cdef generic_pd operand
2673
*
2674
* cdef class sqr_pd(unary_pd): # <<<<<<<<<<<<<<
2675
* pass
2676
*
2677
*/
2678
2679
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd {
2680
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
2681
};
2682
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd;
2683
2684
2685
/* "polynomial_compiled.pxd":44
2686
* pass
2687
*
2688
* cdef class pow_pd(unary_pd): # <<<<<<<<<<<<<<
2689
* cdef object exponent
2690
*
2691
*/
2692
2693
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd {
2694
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd __pyx_base;
2695
};
2696
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd;
2697
2698
2699
/* "polynomial_compiled.pxd":48
2700
*
2701
*
2702
* cdef class binary_pd(generic_pd): # <<<<<<<<<<<<<<
2703
* cdef generic_pd left, right
2704
*
2705
*/
2706
2707
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd {
2708
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd __pyx_base;
2709
};
2710
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd;
2711
2712
2713
/* "polynomial_compiled.pxd":51
2714
* cdef generic_pd left, right
2715
*
2716
* cdef class add_pd(binary_pd): # <<<<<<<<<<<<<<
2717
* pass
2718
*
2719
*/
2720
2721
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd {
2722
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
2723
};
2724
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_add_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_add_pd;
2725
2726
2727
/* "polynomial_compiled.pxd":54
2728
* pass
2729
*
2730
* cdef class mul_pd(binary_pd): # <<<<<<<<<<<<<<
2731
* pass
2732
*
2733
*/
2734
2735
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd {
2736
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
2737
};
2738
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd;
2739
2740
2741
/* "polynomial_compiled.pxd":57
2742
* pass
2743
*
2744
* cdef class abc_pd(binary_pd): # <<<<<<<<<<<<<<
2745
* cdef int index
2746
*
2747
*/
2748
2749
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd {
2750
struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd __pyx_base;
2751
};
2752
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd *__pyx_vtabptr_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd;
2753
2754
2755
/* "sage/rings/polynomial/polynomial_element.pxd":8
2756
*
2757
*
2758
* cdef class Polynomial(CommutativeAlgebraElement): # <<<<<<<<<<<<<<
2759
* cdef char _is_gen
2760
* cdef CompiledPolynomialFunction _compiled
2761
*/
2762
2763
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial {
2764
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement __pyx_base;
2765
struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *(*truncate)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long, int __pyx_skip_dispatch);
2766
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);
2767
long (*_hash_c)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *);
2768
PyObject *(*constant_coefficient)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
2769
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);
2770
int (*is_zero)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
2771
int (*is_one)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, int __pyx_skip_dispatch);
2772
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);
2773
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);
2774
PyObject *(*_inplace_truncate)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, long);
2775
PyObject *(*get_unsafe)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial *, Py_ssize_t);
2776
};
2777
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial;
2778
2779
2780
/* "sage/rings/polynomial/polynomial_element.pxd":29
2781
* cdef get_unsafe(self, Py_ssize_t i)
2782
*
2783
* cdef class Polynomial_generic_dense(Polynomial): # <<<<<<<<<<<<<<
2784
* cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P)
2785
* cdef list __coeffs
2786
*/
2787
2788
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense {
2789
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial __pyx_base;
2790
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 *);
2791
int (*__pyx___normalize)(struct __pyx_obj_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *);
2792
};
2793
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense;
2794
2795
2796
/* "sage/rings/polynomial/polynomial_element.pxd":34
2797
* cdef int __normalize(self) except -1
2798
*
2799
* cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense): # <<<<<<<<<<<<<<
2800
* pass
2801
*
2802
*/
2803
2804
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact {
2805
struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense __pyx_base;
2806
};
2807
static struct __pyx_vtabstruct_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact *__pyx_vtabptr_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact;
2808
2809
2810
/* "sage/libs/ntl/ntl_ZZX.pxd":3
2811
* from .types cimport ZZX_c
2812
*
2813
* cdef class ntl_ZZX(object): # <<<<<<<<<<<<<<
2814
* cdef ZZX_c x
2815
* cdef void setitem_from_int(ntl_ZZX self, long i, int value)
2816
*/
2817
2818
struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX {
2819
void (*setitem_from_int)(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *, long, int);
2820
int (*getitem_as_int)(struct __pyx_obj_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *, long);
2821
};
2822
static struct __pyx_vtabstruct_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX *__pyx_vtabptr_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX;
2823
2824
2825
/* "sage/libs/ntl/ntl_ZZ.pxd":3
2826
* from sage.libs.ntl.types cimport ZZ_c
2827
*
2828
* cdef class ntl_ZZ(object): # <<<<<<<<<<<<<<
2829
* cdef ZZ_c x
2830
* cdef int get_as_int(ntl_ZZ self)
2831
*/
2832
2833
struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ {
2834
int (*get_as_int)(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *);
2835
void (*set_from_int)(struct __pyx_obj_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *, int);
2836
};
2837
static struct __pyx_vtabstruct_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ *__pyx_vtabptr_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ;
2838
2839
2840
/* "number_field_element.pxd":11
2841
* from sage.libs.ntl.ntl_ZZ cimport ntl_ZZ
2842
*
2843
* cdef class NumberFieldElement(FieldElement): # <<<<<<<<<<<<<<
2844
* cdef ZZX_c __numerator
2845
* cdef ZZ_c __denominator
2846
*/
2847
2848
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement {
2849
struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement __pyx_base;
2850
PyObject *(*_new)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
2851
PyObject *(*number_field)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
2852
void (*_ntl_coeff_as_mpz)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, __mpz_struct *, long);
2853
void (*_ntl_denom_as_mpz)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, __mpz_struct *);
2854
void (*_reduce_c_)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *);
2855
PyObject *(*_coefficients)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
2856
int (*is_rational)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
2857
int (*is_one)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, int __pyx_skip_dispatch);
2858
int (*_randomize)(struct __pyx_obj_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *, PyObject *, PyObject *, PyObject *);
2859
};
2860
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement;
2861
2862
2863
/* "number_field_element.pxd":38
2864
*
2865
*
2866
* cdef class NumberFieldElement_absolute(NumberFieldElement): # <<<<<<<<<<<<<<
2867
* pass
2868
*
2869
*/
2870
2871
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute {
2872
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
2873
};
2874
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute;
2875
2876
2877
/* "number_field_element.pxd":41
2878
* pass
2879
*
2880
* cdef class NumberFieldElement_relative(NumberFieldElement): # <<<<<<<<<<<<<<
2881
* pass
2882
*
2883
*/
2884
2885
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative {
2886
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement __pyx_base;
2887
};
2888
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative;
2889
2890
2891
/* "number_field_element.pxd":46
2892
* # TODO: cyclotomic and/or quadratic classes? (Both for differing implementations and speed).
2893
*
2894
* cdef class OrderElement_absolute(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
2895
* cdef object _number_field
2896
*
2897
*/
2898
2899
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute {
2900
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
2901
};
2902
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute;
2903
2904
2905
/* "number_field_element.pxd":49
2906
* cdef object _number_field
2907
*
2908
* cdef class OrderElement_relative(NumberFieldElement_relative): # <<<<<<<<<<<<<<
2909
* cdef object _number_field
2910
*/
2911
2912
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative {
2913
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative __pyx_base;
2914
};
2915
static struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_OrderElement_relative *__pyx_vtabptr_4sage_5rings_12number_field_20number_field_element_OrderElement_relative;
2916
2917
2918
/* "sage/rings/number_field/number_field_element_quadratic.pxd":6
2919
*
2920
*
2921
* cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): # <<<<<<<<<<<<<<
2922
* # (a + b sqrt(D)) / denom
2923
* cdef mpz_t a, b, denom
2924
*/
2925
2926
struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic {
2927
struct __pyx_vtabstruct_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute __pyx_base;
2928
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);
2929
int (*is_sqrt_disc)(struct __pyx_obj_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic *);
2930
};
2931
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;
2932
2933
2934
/* "sage/rings/number_field/number_field_element_quadratic.pxd":19
2935
*
2936
*
2937
* cdef class OrderElement_quadratic(NumberFieldElement_quadratic): # <<<<<<<<<<<<<<
2938
* pass
2939
*/
2940
2941
struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic {
2942
struct __pyx_vtabstruct_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic __pyx_base;
2943
};
2944
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;
2945
2946
2947
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":7
2948
* ctypedef long residue_element[2]
2949
*
2950
* cdef class ResidueRingElement # <<<<<<<<<<<<<<
2951
*
2952
* cdef class ResidueRing_abstract(CommutativeRing):
2953
*/
2954
2955
struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement {
2956
long (*index)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2957
PyObject *(*parent)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2958
PyObject *(*new_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *);
2959
int (*is_unit)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2960
int (*is_square)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2961
PyObject *(*sqrt)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch);
2962
};
2963
static struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement;
2964
2965
2966
/* "psage/modform/hilbert/sqrt5/sqrt5_fast.pxd":9
2967
* cdef class ResidueRingElement
2968
*
2969
* cdef class ResidueRing_abstract(CommutativeRing): # <<<<<<<<<<<<<<
2970
* cdef object P, F
2971
* cdef public object element_class, _residue_field
2972
*/
2973
2974
struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract {
2975
struct __pyx_vtabstruct_4sage_5rings_4ring_CommutativeRing __pyx_base;
2976
PyObject *(*element_to_residue_field)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2977
void (*add)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long *);
2978
void (*sub)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long *);
2979
void (*mul)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long *);
2980
int (*inv)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2981
int (*is_unit)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2982
void (*neg)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2983
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *(*new_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *);
2984
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 *);
2985
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 *);
2986
int (*element_is_1)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2987
int (*element_is_0)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2988
void (*set_element_to_1)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2989
void (*set_element_to_0)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2990
void (*set_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2991
int (*set_element_from_tuple)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, PyObject *);
2992
int (*cmp_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2993
int (*pow)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *, long);
2994
int (*is_square)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
2995
int (*sqrt)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
2996
int (*ith_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long);
2997
long (*cardinality)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, int __pyx_skip_dispatch);
2998
void (*unsafe_ith_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long);
2999
int (*next_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
3000
int (*is_last_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
3001
long (*index_of_element)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
3002
long (*index_of_element_in_P)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
3003
int (*next_element_in_P)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *, long *);
3004
int (*is_last_element_in_P)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
3005
PyObject *(*element_to_str)(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, long *);
3006
};
3007
static struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_vtabptr_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract;
3008
3009
3010
/* "sage/stats/intlist.pxd":8
3011
* #############################################################################
3012
*
3013
* cdef class IntList: # <<<<<<<<<<<<<<
3014
* cdef int* _values
3015
* cdef Py_ssize_t _length
3016
*/
3017
3018
struct __pyx_vtabstruct_4sage_5stats_7intlist_IntList {
3019
int (*prod)(struct __pyx_obj_4sage_5stats_7intlist_IntList *, int __pyx_skip_dispatch);
3020
int (*sum)(struct __pyx_obj_4sage_5stats_7intlist_IntList *, int __pyx_skip_dispatch);
3021
};
3022
static struct __pyx_vtabstruct_4sage_5stats_7intlist_IntList *__pyx_vtabptr_4sage_5stats_7intlist_IntList;
3023
3024
3025
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":365
3026
* return C
3027
*
3028
* cdef class InertTraceCalculator: # <<<<<<<<<<<<<<
3029
* cdef public dict tables
3030
*
3031
*/
3032
3033
struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator {
3034
long (*trace_of_frobenius)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, PyObject *, PyObject *, long, int __pyx_skip_dispatch);
3035
int (*cube_table)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, struct __pyx_obj_4sage_5stats_7intlist_IntList *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *);
3036
int (*init_squares_table)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, struct __pyx_obj_4sage_5stats_7intlist_IntList *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *);
3037
int (*elliptic_curve_from_j)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, long *, long *, long *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *);
3038
int (*ap_via_enumeration)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, int *, int *, long *, long *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, struct __pyx_obj_4sage_5stats_7intlist_IntList *, struct __pyx_obj_4sage_5stats_7intlist_IntList *);
3039
};
3040
static struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_vtabptr_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator;
3041
3042
/* --- Runtime support code (head) --- */
3043
/* Refnanny.proto */
3044
#ifndef CYTHON_REFNANNY
3045
#define CYTHON_REFNANNY 0
3046
#endif
3047
#if CYTHON_REFNANNY
3048
typedef struct {
3049
void (*INCREF)(void*, PyObject*, int);
3050
void (*DECREF)(void*, PyObject*, int);
3051
void (*GOTREF)(void*, PyObject*, int);
3052
void (*GIVEREF)(void*, PyObject*, int);
3053
void* (*SetupContext)(const char*, int, const char*);
3054
void (*FinishContext)(void**);
3055
} __Pyx_RefNannyAPIStruct;
3056
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
3057
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
3058
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
3059
#ifdef WITH_THREAD
3060
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
3061
if (acquire_gil) {\
3062
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
3063
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
3064
PyGILState_Release(__pyx_gilstate_save);\
3065
} else {\
3066
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
3067
}
3068
#else
3069
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
3070
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
3071
#endif
3072
#define __Pyx_RefNannyFinishContext()\
3073
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
3074
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3075
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3076
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3077
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
3078
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
3079
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
3080
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
3081
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
3082
#else
3083
#define __Pyx_RefNannyDeclarations
3084
#define __Pyx_RefNannySetupContext(name, acquire_gil)
3085
#define __Pyx_RefNannyFinishContext()
3086
#define __Pyx_INCREF(r) Py_INCREF(r)
3087
#define __Pyx_DECREF(r) Py_DECREF(r)
3088
#define __Pyx_GOTREF(r)
3089
#define __Pyx_GIVEREF(r)
3090
#define __Pyx_XINCREF(r) Py_XINCREF(r)
3091
#define __Pyx_XDECREF(r) Py_XDECREF(r)
3092
#define __Pyx_XGOTREF(r)
3093
#define __Pyx_XGIVEREF(r)
3094
#endif
3095
#define __Pyx_XDECREF_SET(r, v) do {\
3096
PyObject *tmp = (PyObject *) r;\
3097
r = v; __Pyx_XDECREF(tmp);\
3098
} while (0)
3099
#define __Pyx_DECREF_SET(r, v) do {\
3100
PyObject *tmp = (PyObject *) r;\
3101
r = v; __Pyx_DECREF(tmp);\
3102
} while (0)
3103
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
3104
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
3105
3106
/* PyObjectGetAttrStr.proto */
3107
#if CYTHON_USE_TYPE_SLOTS
3108
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
3109
PyTypeObject* tp = Py_TYPE(obj);
3110
if (likely(tp->tp_getattro))
3111
return tp->tp_getattro(obj, attr_name);
3112
#if PY_MAJOR_VERSION < 3
3113
if (likely(tp->tp_getattr))
3114
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
3115
#endif
3116
return PyObject_GetAttr(obj, attr_name);
3117
}
3118
#else
3119
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
3120
#endif
3121
3122
/* GetBuiltinName.proto */
3123
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
3124
3125
/* ExtTypeTest.proto */
3126
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
3127
3128
/* PyThreadStateGet.proto */
3129
#if CYTHON_FAST_THREAD_STATE
3130
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
3131
#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
3132
#else
3133
#define __Pyx_PyThreadState_declare
3134
#define __Pyx_PyThreadState_assign
3135
#endif
3136
3137
/* PyErrFetchRestore.proto */
3138
#if CYTHON_FAST_THREAD_STATE
3139
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
3140
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
3141
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
3142
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
3143
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
3144
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
3145
#else
3146
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
3147
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
3148
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
3149
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
3150
#endif
3151
3152
/* RaiseException.proto */
3153
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
3154
3155
/* None.proto */
3156
static CYTHON_INLINE long __Pyx_div_long(long, long);
3157
3158
/* RaiseArgTupleInvalid.proto */
3159
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
3160
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
3161
3162
/* RaiseDoubleKeywords.proto */
3163
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
3164
3165
/* ParseKeywords.proto */
3166
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
3167
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
3168
const char* function_name);
3169
3170
/* ArgTypeTest.proto */
3171
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
3172
const char *name, int exact);
3173
3174
/* KeywordStringCheck.proto */
3175
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
3176
3177
/* PyCFunctionFastCall.proto */
3178
#if CYTHON_FAST_PYCCALL
3179
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
3180
#else
3181
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
3182
#endif
3183
3184
/* PyFunctionFastCall.proto */
3185
#if CYTHON_FAST_PYCALL
3186
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
3187
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
3188
#if 1 || PY_VERSION_HEX < 0x030600B1
3189
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
3190
#else
3191
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
3192
#endif
3193
#endif
3194
3195
/* PyObjectCall.proto */
3196
#if CYTHON_COMPILING_IN_CPYTHON
3197
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
3198
#else
3199
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
3200
#endif
3201
3202
/* PyObjectCallMethO.proto */
3203
#if CYTHON_COMPILING_IN_CPYTHON
3204
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
3205
#endif
3206
3207
/* PyObjectCallOneArg.proto */
3208
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
3209
3210
/* GetModuleGlobalName.proto */
3211
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
3212
3213
/* None.proto */
3214
static CYTHON_INLINE long __Pyx_mod_long(long, long);
3215
3216
/* PyObjectCallNoArg.proto */
3217
#if CYTHON_COMPILING_IN_CPYTHON
3218
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
3219
#else
3220
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
3221
#endif
3222
3223
/* RaiseTooManyValuesToUnpack.proto */
3224
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
3225
3226
/* RaiseNeedMoreValuesToUnpack.proto */
3227
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
3228
3229
/* IterFinish.proto */
3230
static CYTHON_INLINE int __Pyx_IterFinish(void);
3231
3232
/* UnpackItemEndCheck.proto */
3233
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
3234
3235
/* GetItemInt.proto */
3236
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3237
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3238
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
3239
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
3240
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
3241
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3242
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3243
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
3244
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
3245
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
3246
int wraparound, int boundscheck);
3247
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
3248
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
3249
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
3250
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
3251
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
3252
int wraparound, int boundscheck);
3253
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
3254
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
3255
int is_list, int wraparound, int boundscheck);
3256
3257
/* ListCompAppend.proto */
3258
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
3259
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
3260
PyListObject* L = (PyListObject*) list;
3261
Py_ssize_t len = Py_SIZE(list);
3262
if (likely(L->allocated > len)) {
3263
Py_INCREF(x);
3264
PyList_SET_ITEM(list, len, x);
3265
Py_SIZE(list) = len+1;
3266
return 0;
3267
}
3268
return PyList_Append(list, x);
3269
}
3270
#else
3271
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
3272
#endif
3273
3274
/* ListAppend.proto */
3275
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
3276
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
3277
PyListObject* L = (PyListObject*) list;
3278
Py_ssize_t len = Py_SIZE(list);
3279
if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
3280
Py_INCREF(x);
3281
PyList_SET_ITEM(list, len, x);
3282
Py_SIZE(list) = len+1;
3283
return 0;
3284
}
3285
return PyList_Append(list, x);
3286
}
3287
#else
3288
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
3289
#endif
3290
3291
/* IncludeStringH.proto */
3292
#include <string.h>
3293
3294
/* BytesEquals.proto */
3295
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
3296
3297
/* UnicodeEquals.proto */
3298
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
3299
3300
/* StrEquals.proto */
3301
#if PY_MAJOR_VERSION >= 3
3302
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
3303
#else
3304
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
3305
#endif
3306
3307
/* SaveResetException.proto */
3308
#if CYTHON_FAST_THREAD_STATE
3309
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
3310
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
3311
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
3312
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
3313
#else
3314
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
3315
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
3316
#endif
3317
3318
/* PyErrExceptionMatches.proto */
3319
#if CYTHON_FAST_THREAD_STATE
3320
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
3321
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
3322
#else
3323
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
3324
#endif
3325
3326
/* GetException.proto */
3327
#if CYTHON_FAST_THREAD_STATE
3328
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
3329
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
3330
#else
3331
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
3332
#endif
3333
3334
/* Import.proto */
3335
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
3336
3337
/* ImportFrom.proto */
3338
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
3339
3340
/* PyIntBinop.proto */
3341
#if !CYTHON_COMPILING_IN_PYPY
3342
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
3343
#else
3344
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
3345
(inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
3346
#endif
3347
3348
/* PyIntBinop.proto */
3349
#if !CYTHON_COMPILING_IN_PYPY
3350
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
3351
#else
3352
#define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace)\
3353
(inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
3354
#endif
3355
3356
/* PySequenceContains.proto */
3357
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
3358
int result = PySequence_Contains(seq, item);
3359
return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
3360
}
3361
3362
/* py_dict_keys.proto */
3363
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);
3364
3365
/* UnpackUnboundCMethod.proto */
3366
typedef struct {
3367
PyObject *type;
3368
PyObject **method_name;
3369
PyCFunction func;
3370
PyObject *method;
3371
int flag;
3372
} __Pyx_CachedCFunction;
3373
3374
/* CallUnboundCMethod0.proto */
3375
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
3376
#if CYTHON_COMPILING_IN_CPYTHON
3377
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
3378
((likely((cfunc)->func)) ?\
3379
(likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\
3380
(likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
3381
((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\
3382
(PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ? (*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM(__pyx_empty_tuple, 0), 0, NULL) :\
3383
__Pyx__CallUnboundCMethod0(cfunc, self))))) :\
3384
__Pyx__CallUnboundCMethod0(cfunc, self))
3385
#else
3386
#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
3387
#endif
3388
3389
/* DictGetItem.proto */
3390
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
3391
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
3392
PyObject *value;
3393
value = PyDict_GetItemWithError(d, key);
3394
if (unlikely(!value)) {
3395
if (!PyErr_Occurred()) {
3396
PyObject* args = PyTuple_Pack(1, key);
3397
if (likely(args))
3398
PyErr_SetObject(PyExc_KeyError, args);
3399
Py_XDECREF(args);
3400
}
3401
return NULL;
3402
}
3403
Py_INCREF(value);
3404
return value;
3405
}
3406
#else
3407
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
3408
#endif
3409
3410
/* FetchCommonType.proto */
3411
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
3412
3413
/* CythonFunction.proto */
3414
#define __Pyx_CyFunction_USED 1
3415
#include <structmember.h>
3416
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
3417
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
3418
#define __Pyx_CYFUNCTION_CCLASS 0x04
3419
#define __Pyx_CyFunction_GetClosure(f)\
3420
(((__pyx_CyFunctionObject *) (f))->func_closure)
3421
#define __Pyx_CyFunction_GetClassObj(f)\
3422
(((__pyx_CyFunctionObject *) (f))->func_classobj)
3423
#define __Pyx_CyFunction_Defaults(type, f)\
3424
((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
3425
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
3426
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
3427
typedef struct {
3428
PyCFunctionObject func;
3429
#if PY_VERSION_HEX < 0x030500A0
3430
PyObject *func_weakreflist;
3431
#endif
3432
PyObject *func_dict;
3433
PyObject *func_name;
3434
PyObject *func_qualname;
3435
PyObject *func_doc;
3436
PyObject *func_globals;
3437
PyObject *func_code;
3438
PyObject *func_closure;
3439
PyObject *func_classobj;
3440
void *defaults;
3441
int defaults_pyobjects;
3442
int flags;
3443
PyObject *defaults_tuple;
3444
PyObject *defaults_kwdict;
3445
PyObject *(*defaults_getter)(PyObject *);
3446
PyObject *func_annotations;
3447
} __pyx_CyFunctionObject;
3448
static PyTypeObject *__pyx_CyFunctionType = 0;
3449
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
3450
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
3451
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
3452
int flags, PyObject* qualname,
3453
PyObject *self,
3454
PyObject *module, PyObject *globals,
3455
PyObject* code);
3456
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
3457
size_t size,
3458
int pyobjects);
3459
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
3460
PyObject *tuple);
3461
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
3462
PyObject *dict);
3463
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
3464
PyObject *dict);
3465
static int __pyx_CyFunction_init(void);
3466
3467
/* SetVTable.proto */
3468
static int __Pyx_SetVtable(PyObject *dict, void *vtable);
3469
3470
/* GetVTable.proto */
3471
static void* __Pyx_GetVtable(PyObject *dict);
3472
3473
/* CodeObjectCache.proto */
3474
typedef struct {
3475
PyCodeObject* code_object;
3476
int code_line;
3477
} __Pyx_CodeObjectCacheEntry;
3478
struct __Pyx_CodeObjectCache {
3479
int count;
3480
int max_count;
3481
__Pyx_CodeObjectCacheEntry* entries;
3482
};
3483
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
3484
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
3485
static PyCodeObject *__pyx_find_code_object(int code_line);
3486
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
3487
3488
/* AddTraceback.proto */
3489
static void __Pyx_AddTraceback(const char *funcname, int c_line,
3490
int py_line, const char *filename);
3491
3492
/* CIntToPy.proto */
3493
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
3494
3495
/* CIntToPy.proto */
3496
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value);
3497
3498
/* CIntToPy.proto */
3499
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
3500
3501
/* None.proto */
3502
#include <new>
3503
3504
/* CIntFromPy.proto */
3505
static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *);
3506
3507
/* CIntFromPy.proto */
3508
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
3509
3510
/* CIntFromPy.proto */
3511
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
3512
3513
/* CheckBinaryVersion.proto */
3514
static int __Pyx_check_binary_version(void);
3515
3516
/* PyIdentifierFromString.proto */
3517
#if !defined(__Pyx_PyIdentifier_FromString)
3518
#if PY_MAJOR_VERSION < 3
3519
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
3520
#else
3521
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
3522
#endif
3523
#endif
3524
3525
/* ModuleImport.proto */
3526
static PyObject *__Pyx_ImportModule(const char *name);
3527
3528
/* TypeImport.proto */
3529
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
3530
3531
/* VoidPtrImport.proto */
3532
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
3533
3534
/* InitStrings.proto */
3535
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
3536
3537
static long __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_trace_of_frobenius(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, PyObject *__pyx_v_j0, PyObject *__pyx_v_c_quo0, long __pyx_v_p, int __pyx_skip_dispatch); /* proto*/
3538
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_cube_table(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_cubes, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R); /* proto*/
3539
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_init_squares_table(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_squares, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R); /* proto*/
3540
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_elliptic_curve_from_j(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, long *__pyx_v_a4, long *__pyx_v_a6, long *__pyx_v_j, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R); /* proto*/
3541
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_ap_via_enumeration(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, int *__pyx_v_ap, int *__pyx_v_c_quo, long *__pyx_v_a4, long *__pyx_v_a6, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_squares, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_cubes); /* proto*/
3542
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*/
3543
3544
/* Module declarations from 'libc.stdint' */
3545
3546
/* Module declarations from 'libc.string' */
3547
3548
/* Module declarations from 'libc.stdio' */
3549
3550
/* Module declarations from '__builtin__' */
3551
3552
/* Module declarations from 'cpython.type' */
3553
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
3554
3555
/* Module declarations from 'cpython.version' */
3556
3557
/* Module declarations from 'cpython.ref' */
3558
3559
/* Module declarations from 'cpython.exc' */
3560
3561
/* Module declarations from 'cpython.module' */
3562
3563
/* Module declarations from 'cpython.mem' */
3564
3565
/* Module declarations from 'cpython.tuple' */
3566
3567
/* Module declarations from 'cpython.list' */
3568
3569
/* Module declarations from 'cpython.sequence' */
3570
3571
/* Module declarations from 'cpython.mapping' */
3572
3573
/* Module declarations from 'cpython.iterator' */
3574
3575
/* Module declarations from 'cpython.number' */
3576
3577
/* Module declarations from 'cpython.int' */
3578
3579
/* Module declarations from '__builtin__' */
3580
3581
/* Module declarations from 'cpython.bool' */
3582
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
3583
3584
/* Module declarations from 'cpython.long' */
3585
3586
/* Module declarations from 'cpython.float' */
3587
3588
/* Module declarations from '__builtin__' */
3589
3590
/* Module declarations from 'cpython.complex' */
3591
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
3592
3593
/* Module declarations from 'cpython.string' */
3594
3595
/* Module declarations from 'cpython.unicode' */
3596
3597
/* Module declarations from 'cpython.dict' */
3598
3599
/* Module declarations from 'cpython.instance' */
3600
3601
/* Module declarations from 'cpython.function' */
3602
3603
/* Module declarations from 'cpython.method' */
3604
3605
/* Module declarations from 'cpython.weakref' */
3606
3607
/* Module declarations from 'cpython.getargs' */
3608
3609
/* Module declarations from 'cpython.pythread' */
3610
3611
/* Module declarations from 'cpython.pystate' */
3612
3613
/* Module declarations from 'cpython.cobject' */
3614
3615
/* Module declarations from 'cpython.oldbuffer' */
3616
3617
/* Module declarations from 'cpython.set' */
3618
3619
/* Module declarations from 'cpython.buffer' */
3620
3621
/* Module declarations from 'cpython.bytes' */
3622
3623
/* Module declarations from 'cpython.pycapsule' */
3624
3625
/* Module declarations from 'cpython' */
3626
3627
/* Module declarations from 'cpython.object' */
3628
3629
/* Module declarations from 'sage.structure.sage_object' */
3630
static PyTypeObject *__pyx_ptype_4sage_9structure_11sage_object_SageObject = 0;
3631
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(PyObject *, PyObject *, int, int __pyx_skip_dispatch); /*proto*/
3632
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool(int, int, int __pyx_skip_dispatch); /*proto*/
3633
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(int, int, int __pyx_skip_dispatch); /*proto*/
3634
3635
/* Module declarations from 'sage.structure.category_object' */
3636
static PyTypeObject *__pyx_ptype_4sage_9structure_15category_object_CategoryObject = 0;
3637
3638
/* Module declarations from 'cython' */
3639
3640
/* Module declarations from 'sage.structure.coerce_dict' */
3641
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = 0;
3642
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = 0;
3643
3644
/* Module declarations from 'sage.misc.cython_metaclass' */
3645
3646
/* Module declarations from 'sage.misc' */
3647
3648
/* Module declarations from 'sage.misc.inherit_comparison' */
3649
static PyTypeObject *__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = 0;
3650
3651
/* Module declarations from 'sage.structure.element' */
3652
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Element = 0;
3653
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = 0;
3654
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ModuleElement = 0;
3655
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_RingElement = 0;
3656
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MonoidElement = 0;
3657
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = 0;
3658
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = 0;
3659
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeRingElement = 0;
3660
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_IntegralDomainElement = 0;
3661
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_DedekindDomainElement = 0;
3662
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = 0;
3663
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = 0;
3664
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_FieldElement = 0;
3665
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AlgebraElement = 0;
3666
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = 0;
3667
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_InfinityElement = 0;
3668
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Vector = 0;
3669
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Matrix = 0;
3670
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CoercionModel = 0;
3671
static struct __pyx_obj_4sage_9structure_7element_CoercionModel **__pyx_vp_4sage_9structure_7element_coercion_model = 0;
3672
#define __pyx_v_4sage_9structure_7element_coercion_model (*__pyx_vp_4sage_9structure_7element_coercion_model)
3673
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *, int __pyx_skip_dispatch); /*proto*/
3674
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *, PyObject *); /*proto*/
3675
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int); /*proto*/
3676
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
3677
3678
/* Module declarations from 'sage.structure' */
3679
3680
/* Module declarations from 'sage' */
3681
3682
/* Module declarations from 'sage.structure.parent' */
3683
static PyTypeObject *__pyx_ptype_4sage_9structure_6parent_Parent = 0;
3684
3685
/* Module declarations from 'sage.structure.parent_old' */
3686
static PyTypeObject *__pyx_ptype_4sage_9structure_10parent_old_Parent = 0;
3687
3688
/* Module declarations from 'sage.structure.parent_base' */
3689
static PyTypeObject *__pyx_ptype_4sage_9structure_11parent_base_ParentWithBase = 0;
3690
3691
/* Module declarations from 'sage.structure.parent_gens' */
3692
static PyTypeObject *__pyx_ptype_4sage_9structure_11parent_gens_ParentWithGens = 0;
3693
3694
/* Module declarations from 'sage.rings.ring' */
3695
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Ring = 0;
3696
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_CommutativeRing = 0;
3697
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_IntegralDomain = 0;
3698
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_DedekindDomain = 0;
3699
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_PrincipalIdealDomain = 0;
3700
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_EuclideanDomain = 0;
3701
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Field = 0;
3702
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_Algebra = 0;
3703
static PyTypeObject *__pyx_ptype_4sage_5rings_4ring_CommutativeAlgebra = 0;
3704
3705
/* Module declarations from 'sage.libs.gmp.types' */
3706
3707
/* Module declarations from 'sage.libs.ntl.types' */
3708
3709
/* Module declarations from 'sage.categories.map' */
3710
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Map = 0;
3711
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Section = 0;
3712
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_FormalCompositeMap = 0;
3713
3714
/* Module declarations from 'sage.categories.morphism' */
3715
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_Morphism = 0;
3716
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_SetMorphism = 0;
3717
3718
/* Module declarations from 'sage.rings.integer' */
3719
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_Integer = 0;
3720
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_int_to_Z = 0;
3721
3722
/* Module declarations from 'sage.misc.binary_tree' */
3723
static PyTypeObject *__pyx_ptype_4sage_4misc_11binary_tree_BinaryTree = 0;
3724
3725
/* Module declarations from 'sage.rings.polynomial.polynomial_compiled' */
3726
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_generic_pd = 0;
3727
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_CompiledPolynomialFunction = 0;
3728
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_dummy_pd = 0;
3729
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_var_pd = 0;
3730
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_univar_pd = 0;
3731
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_coeff_pd = 0;
3732
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_unary_pd = 0;
3733
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_sqr_pd = 0;
3734
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_pow_pd = 0;
3735
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_binary_pd = 0;
3736
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_add_pd = 0;
3737
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_mul_pd = 0;
3738
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_19polynomial_compiled_abc_pd = 0;
3739
3740
/* Module declarations from 'sage.rings.polynomial.polynomial_element' */
3741
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial = 0;
3742
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense = 0;
3743
static PyTypeObject *__pyx_ptype_4sage_5rings_10polynomial_18polynomial_element_Polynomial_generic_dense_inexact = 0;
3744
3745
/* Module declarations from 'sage.libs.ntl.ntl_ZZX' */
3746
static PyTypeObject *__pyx_ptype_4sage_4libs_3ntl_7ntl_ZZX_ntl_ZZX = 0;
3747
3748
/* Module declarations from 'sage.libs.ntl.ntl_ZZ' */
3749
static PyTypeObject *__pyx_ptype_4sage_4libs_3ntl_6ntl_ZZ_ntl_ZZ = 0;
3750
3751
/* Module declarations from 'sage.rings.number_field.number_field_element' */
3752
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement = 0;
3753
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_absolute = 0;
3754
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_NumberFieldElement_relative = 0;
3755
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_absolute = 0;
3756
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_20number_field_element_OrderElement_relative = 0;
3757
3758
/* Module declarations from 'sage.rings.number_field.number_field_element_quadratic' */
3759
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_NumberFieldElement_quadratic = 0;
3760
static PyTypeObject *__pyx_ptype_4sage_5rings_12number_field_30number_field_element_quadratic_OrderElement_quadratic = 0;
3761
3762
/* Module declarations from 'psage.modform.hilbert.sqrt5.sqrt5_fast' */
3763
static PyTypeObject *__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement = 0;
3764
static PyTypeObject *__pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract = 0;
3765
3766
/* Module declarations from 'sage.libs.gmp.mpz' */
3767
3768
/* Module declarations from 'cysignals.__init__' */
3769
3770
/* Module declarations from 'cysignals' */
3771
3772
/* Module declarations from 'cysignals.signals' */
3773
static cysigs_t *__pyx_vp_9cysignals_7signals_cysigs = 0;
3774
#define cysigs (*__pyx_vp_9cysignals_7signals_cysigs)
3775
static void (*__pyx_f_9cysignals_7signals_print_backtrace)(void); /*proto*/
3776
static void (*__pyx_f_9cysignals_7signals__sig_on_interrupt_received)(void); /*proto*/
3777
static void (*__pyx_f_9cysignals_7signals__sig_on_recover)(void); /*proto*/
3778
static void (*__pyx_f_9cysignals_7signals__sig_off_warning)(char const *, int); /*proto*/
3779
3780
/* Module declarations from 'libc.stdlib' */
3781
3782
/* Module declarations from 'cysignals.memory' */
3783
static CYTHON_INLINE void *sig_malloc(size_t); /*proto*/
3784
static CYTHON_INLINE void *sig_realloc(void *, size_t); /*proto*/
3785
static CYTHON_INLINE void *sig_calloc(size_t, size_t); /*proto*/
3786
static CYTHON_INLINE void sig_free(void *); /*proto*/
3787
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t, size_t); /*proto*/
3788
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t, size_t); /*proto*/
3789
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *, size_t, size_t); /*proto*/
3790
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t); /*proto*/
3791
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *, size_t); /*proto*/
3792
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t, size_t); /*proto*/
3793
3794
/* Module declarations from 'sage.ext.stdsage' */
3795
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *); /*proto*/
3796
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *); /*proto*/
3797
3798
/* Module declarations from 'sage.stats.intlist' */
3799
static PyTypeObject *__pyx_ptype_4sage_5stats_7intlist_IntList = 0;
3800
3801
/* Module declarations from 'code.alex.psage.psage.ellcurve.lseries.sqrt5' */
3802
static PyTypeObject *__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius = 0;
3803
static PyTypeObject *__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator = 0;
3804
static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = 0;
3805
static long __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN;
3806
static long __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *, int __pyx_skip_dispatch); /*proto*/
3807
static unsigned long __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_sqrt_mod(unsigned long, unsigned long, int __pyx_skip_dispatch); /*proto*/
3808
static PyObject *__Pyx_CFunc_object____object____object____int___to_py(PyObject *(*)(PyObject *, PyObject *, int)); /*proto*/
3809
#define __Pyx_MODULE_NAME "code.alex.psage.psage.ellcurve.lseries.sqrt5"
3810
int __pyx_module_is_main_code__alex__psage__psage__ellcurve__lseries__sqrt5 = 0;
3811
3812
/* Implementation of 'code.alex.psage.psage.ellcurve.lseries.sqrt5' */
3813
static PyObject *__pyx_builtin_ValueError;
3814
static PyObject *__pyx_builtin_range;
3815
static PyObject *__pyx_builtin_RuntimeError;
3816
static PyObject *__pyx_builtin_IndexError;
3817
static PyObject *__pyx_builtin_NotImplementedError;
3818
static PyObject *__pyx_builtin_MemoryError;
3819
static PyObject *__pyx_builtin_AttributeError;
3820
static const char __pyx_k_C[] = "C";
3821
static const char __pyx_k_E[] = "E";
3822
static const char __pyx_k_F[] = "F";
3823
static const char __pyx_k_N[] = "N";
3824
static const char __pyx_k_R[] = "R";
3825
static const char __pyx_k_a[] = "a";
3826
static const char __pyx_k_c[] = "c";
3827
static const char __pyx_k_p[] = "p";
3828
static const char __pyx_k_s[] = "s";
3829
static const char __pyx_k_x[] = "x";
3830
static const char __pyx_k_y[] = "y";
3831
static const char __pyx_k_a4[] = "a4";
3832
static const char __pyx_k_a6[] = "a6";
3833
static const char __pyx_k_ap[] = "ap";
3834
static const char __pyx_k_j0[] = "j0";
3835
static const char __pyx_k_op[] = "op";
3836
static const char __pyx_k_gen[] = "gen";
3837
static const char __pyx_k_arg0[] = "arg0";
3838
static const char __pyx_k_arg1[] = "arg1";
3839
static const char __pyx_k_arg2[] = "arg2";
3840
static const char __pyx_k_keys[] = "keys";
3841
static const char __pyx_k_left[] = "left";
3842
static const char __pyx_k_main[] = "__main__";
3843
static const char __pyx_k_math[] = "math";
3844
static const char __pyx_k_pari[] = "pari";
3845
static const char __pyx_k_sqrt[] = "sqrt";
3846
static const char __pyx_k_test[] = "__test__";
3847
static const char __pyx_k_wrap[] = "wrap";
3848
static const char __pyx_k_bound[] = "bound";
3849
static const char __pyx_k_c_quo[] = "c_quo";
3850
static const char __pyx_k_ideal[] = "ideal";
3851
static const char __pyx_k_parts[] = "parts";
3852
static const char __pyx_k_prime[] = "prime";
3853
static const char __pyx_k_range[] = "range";
3854
static const char __pyx_k_right[] = "right";
3855
static const char __pyx_k_sqrt5[] = "sqrt5";
3856
static const char __pyx_k_aplist[] = "aplist";
3857
static const char __pyx_k_c_quo0[] = "c_quo0";
3858
static const char __pyx_k_import[] = "__import__";
3859
static const char __pyx_k_parent[] = "parent";
3860
static const char __pyx_k_primes[] = "primes";
3861
static const char __pyx_k_tables[] = "tables";
3862
static const char __pyx_k_squares[] = "squares";
3863
static const char __pyx_k_verbose[] = "verbose";
3864
static const char __pyx_k_prime_pi[] = "prime_pi";
3865
static const char __pyx_k_sage_all[] = "sage.all";
3866
static const char __pyx_k_smalljac[] = "smalljac";
3867
static const char __pyx_k_algorithm[] = "algorithm";
3868
static const char __pyx_k_IndexError[] = "IndexError";
3869
static const char __pyx_k_ValueError[] = "ValueError";
3870
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
3871
static const char __pyx_k_MemoryError[] = "MemoryError";
3872
static const char __pyx_k_ResidueRing[] = "ResidueRing";
3873
static const char __pyx_k_cfunc_to_py[] = "cfunc.to_py";
3874
static const char __pyx_k_deprecation[] = "deprecation";
3875
static const char __pyx_k_get_verbose[] = "get_verbose";
3876
static const char __pyx_k_inert_table[] = "inert_table";
3877
static const char __pyx_k_prime_range[] = "prime_range";
3878
static const char __pyx_k_RuntimeError[] = "RuntimeError";
3879
static const char __pyx_k_a_invariants[] = "a_invariants";
3880
static const char __pyx_k_inert_primes[] = "inert_primes";
3881
static const char __pyx_k_stringsource[] = "stringsource";
3882
static const char __pyx_k_AttributeError[] = "AttributeError";
3883
static const char __pyx_k_naive_i_s_a__s[] = "naive i=%s, a_{%s}";
3884
static const char __pyx_k_sage_ext_memory[] = "sage.ext.memory";
3885
static const char __pyx_k_elliptic_curve_ap[] = "elliptic_curve_ap";
3886
static const char __pyx_k_trace_of_frobenius[] = "trace_of_frobenius";
3887
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
3888
static const char __pyx_k_compute_naive_trace[] = "_compute_naive_trace";
3889
static const char __pyx_k_compute_split_traces[] = "_compute_split_traces";
3890
static const char __pyx_k_sage_misc_superseded[] = "sage.misc.superseded";
3891
static const char __pyx_k_init_memory_functions[] = "init_memory_functions";
3892
static const char __pyx_k_initialize_coefficients[] = "_initialize_coefficients";
3893
static const char __pyx_k_i_must_be_between_0_and_s[] = "i must be between 0 and %s";
3894
static const char __pyx_k_Pyx_CFunc_object____object[] = "__Pyx_CFunc_object____object____object____int___to_py.<locals>.wrap";
3895
static const char __pyx_k_failed_to_allocate_s_bytes[] = "failed to allocate %s bytes";
3896
static const char __pyx_k_initialize_prime_ap_tables[] = "_initialize_prime_ap_tables";
3897
static const char __pyx_k_memory_assumption_violated[] = "memory assumption violated";
3898
static const char __pyx_k_ellap_ellinit_0_0_0_s_s_1_s[] = "ellap(ellinit([0,0,0,%s,%s],1),%s)";
3899
static const char __pyx_k_failed_to_allocate_s_s_bytes[] = "failed to allocate %s * %s bytes";
3900
static const char __pyx_k_psage_libs_smalljac_wrapper1[] = "psage.libs.smalljac.wrapper1";
3901
static const char __pyx_k_residue_ring_must_be_a_field[] = "residue ring must be a field";
3902
static const char __pyx_k_unpickle_InertTraceCalculator[] = "unpickle_InertTraceCalculator";
3903
static const char __pyx_k_File_sqrt5_pyx_starting_at_line[] = "File: sqrt5.pyx (starting at line 1)\n\nFast Cython code needed to compute L-series of elliptic curves over F = Q(sqrt(5)).\n\nUSES:\n\n - The fast residue class rings defined in\n psage.modform.hilbert.sqrt5.sqrt5_fast for naive enumeration.\n\n - Drew Sutherlands smalljac for point counting\n\n - Lcalc for evaluating the L-series\n\n - Dokchitser as well.\n\n - Computes the *root number* in addition to the L-series.\n\n";
3904
static const char __pyx_k_compute_inert_and_ramified_trac[] = "_compute_inert_and_ramified_traces";
3905
static const char __pyx_k_compute_remaining_traces_naivel[] = "_compute_remaining_traces_naively";
3906
static const char __pyx_k_projects_68c8b2b8_03ba_44d4_a0d[] = "/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx";
3907
static const char __pyx_k_Inert_trace_calculator_with_prec[] = "Inert trace calculator with precomputed tables for p in {%s}";
3908
static const char __pyx_k_code_alex_psage_psage_ellcurve_l[] = "code.alex.psage.psage.ellcurve.lseries.sqrt5";
3909
static const char __pyx_k_import_cysignals_signals_pxi_ins[] = "import \"cysignals/signals.pxi\" instead of \"sage/ext/interrupt.pxi\"";
3910
static const char __pyx_k_psage_modform_hilbert_sqrt5_sqrt[] = "psage.modform.hilbert.sqrt5.sqrt5";
3911
static const char __pyx_k_skipping_inert_table_computation[] = "skipping inert table computation for p=%s (%s)";
3912
static const char __pyx_k_psage_modform_hilbert_sqrt5_sqrt_2[] = "psage.modform.hilbert.sqrt5.sqrt5_fast";
3913
static PyObject *__pyx_n_s_AttributeError;
3914
static PyObject *__pyx_n_s_C;
3915
static PyObject *__pyx_n_s_E;
3916
static PyObject *__pyx_n_s_F;
3917
static PyObject *__pyx_n_s_IndexError;
3918
static PyObject *__pyx_kp_s_Inert_trace_calculator_with_prec;
3919
static PyObject *__pyx_n_s_MemoryError;
3920
static PyObject *__pyx_n_s_N;
3921
static PyObject *__pyx_n_s_NotImplementedError;
3922
static PyObject *__pyx_n_s_Pyx_CFunc_object____object;
3923
static PyObject *__pyx_n_s_R;
3924
static PyObject *__pyx_n_s_ResidueRing;
3925
static PyObject *__pyx_n_s_RuntimeError;
3926
static PyObject *__pyx_n_s_ValueError;
3927
static PyObject *__pyx_n_s_a;
3928
static PyObject *__pyx_n_s_a4;
3929
static PyObject *__pyx_n_s_a6;
3930
static PyObject *__pyx_n_s_a_invariants;
3931
static PyObject *__pyx_n_s_algorithm;
3932
static PyObject *__pyx_n_s_ap;
3933
static PyObject *__pyx_n_s_aplist;
3934
static PyObject *__pyx_n_s_arg0;
3935
static PyObject *__pyx_n_s_arg1;
3936
static PyObject *__pyx_n_s_arg2;
3937
static PyObject *__pyx_n_s_bound;
3938
static PyObject *__pyx_n_s_c;
3939
static PyObject *__pyx_n_s_c_quo;
3940
static PyObject *__pyx_n_s_c_quo0;
3941
static PyObject *__pyx_n_s_cfunc_to_py;
3942
static PyObject *__pyx_n_s_code_alex_psage_psage_ellcurve_l;
3943
static PyObject *__pyx_n_s_compute_inert_and_ramified_trac;
3944
static PyObject *__pyx_n_s_compute_naive_trace;
3945
static PyObject *__pyx_n_s_compute_remaining_traces_naivel;
3946
static PyObject *__pyx_n_s_compute_split_traces;
3947
static PyObject *__pyx_n_s_deprecation;
3948
static PyObject *__pyx_kp_s_ellap_ellinit_0_0_0_s_s_1_s;
3949
static PyObject *__pyx_n_s_elliptic_curve_ap;
3950
static PyObject *__pyx_kp_s_failed_to_allocate_s_bytes;
3951
static PyObject *__pyx_kp_s_failed_to_allocate_s_s_bytes;
3952
static PyObject *__pyx_n_s_gen;
3953
static PyObject *__pyx_n_s_get_verbose;
3954
static PyObject *__pyx_kp_s_i_must_be_between_0_and_s;
3955
static PyObject *__pyx_n_s_ideal;
3956
static PyObject *__pyx_n_s_import;
3957
static PyObject *__pyx_kp_s_import_cysignals_signals_pxi_ins;
3958
static PyObject *__pyx_n_s_inert_primes;
3959
static PyObject *__pyx_n_s_inert_table;
3960
static PyObject *__pyx_n_s_init_memory_functions;
3961
static PyObject *__pyx_n_s_initialize_coefficients;
3962
static PyObject *__pyx_n_s_initialize_prime_ap_tables;
3963
static PyObject *__pyx_n_s_j0;
3964
static PyObject *__pyx_n_s_keys;
3965
static PyObject *__pyx_n_s_left;
3966
static PyObject *__pyx_n_s_main;
3967
static PyObject *__pyx_n_s_math;
3968
static PyObject *__pyx_kp_s_memory_assumption_violated;
3969
static PyObject *__pyx_kp_s_naive_i_s_a__s;
3970
static PyObject *__pyx_n_s_op;
3971
static PyObject *__pyx_n_s_p;
3972
static PyObject *__pyx_n_s_parent;
3973
static PyObject *__pyx_n_s_pari;
3974
static PyObject *__pyx_n_s_parts;
3975
static PyObject *__pyx_n_s_prime;
3976
static PyObject *__pyx_n_s_prime_pi;
3977
static PyObject *__pyx_n_s_prime_range;
3978
static PyObject *__pyx_n_s_primes;
3979
static PyObject *__pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d;
3980
static PyObject *__pyx_n_s_psage_libs_smalljac_wrapper1;
3981
static PyObject *__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt;
3982
static PyObject *__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt_2;
3983
static PyObject *__pyx_n_s_pyx_vtable;
3984
static PyObject *__pyx_n_s_range;
3985
static PyObject *__pyx_kp_s_residue_ring_must_be_a_field;
3986
static PyObject *__pyx_n_s_right;
3987
static PyObject *__pyx_n_s_s;
3988
static PyObject *__pyx_n_s_sage_all;
3989
static PyObject *__pyx_n_s_sage_ext_memory;
3990
static PyObject *__pyx_n_s_sage_misc_superseded;
3991
static PyObject *__pyx_kp_s_skipping_inert_table_computation;
3992
static PyObject *__pyx_n_s_smalljac;
3993
static PyObject *__pyx_n_s_sqrt;
3994
static PyObject *__pyx_n_s_sqrt5;
3995
static PyObject *__pyx_n_s_squares;
3996
static PyObject *__pyx_kp_s_stringsource;
3997
static PyObject *__pyx_n_s_tables;
3998
static PyObject *__pyx_n_s_test;
3999
static PyObject *__pyx_n_s_trace_of_frobenius;
4000
static PyObject *__pyx_n_s_unpickle_InertTraceCalculator;
4001
static PyObject *__pyx_n_s_verbose;
4002
static PyObject *__pyx_n_s_wrap;
4003
static PyObject *__pyx_n_s_x;
4004
static PyObject *__pyx_n_s_y;
4005
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a4, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a6); /* proto */
4006
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_2sqrt_mod(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_a, unsigned long __pyx_v_p); /* proto */
4007
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius___cinit__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self); /* proto */
4008
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_bound); /* proto */
4009
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_4_initialize_prime_ap_tables(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, long __pyx_v_bound); /* proto */
4010
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_6_initialize_coefficients(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
4011
static void __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_8__dealloc__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self); /* proto */
4012
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_10_tables(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self); /* proto */
4013
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_12aplist(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self); /* proto */
4014
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_14_compute_split_traces(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_algorithm); /* proto */
4015
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_16_compute_inert_and_ramified_traces(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_T); /* proto */
4016
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_18_compute_remaining_traces_naively(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self); /* proto */
4017
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_20_compute_naive_trace(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
4018
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_22prime(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, long __pyx_v_i); /* proto */
4019
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_24_compute_traces(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_inert_table, CYTHON_UNUSED PyObject *__pyx_v_algorithm); /* proto */
4020
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_4inert_primes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_N); /* proto */
4021
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_6unpickle_InertTraceCalculator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tables); /* proto */
4022
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self); /* proto */
4023
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self); /* proto */
4024
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_4__reduce__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self); /* proto */
4025
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6trace_of_frobenius(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, PyObject *__pyx_v_j0, PyObject *__pyx_v_c_quo0, long __pyx_v_p); /* proto */
4026
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_8init_table(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, int __pyx_v_p); /* proto */
4027
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables___get__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self); /* proto */
4028
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_2__set__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
4029
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_4__del__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self); /* proto */
4030
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 */
4031
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 */
4032
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 */
4033
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
4034
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
4035
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 */
4036
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
4037
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
4038
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
4039
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
4040
static PyObject *__pyx_int_0;
4041
static PyObject *__pyx_int_1;
4042
static PyObject *__pyx_int_2;
4043
static PyObject *__pyx_int_3;
4044
static PyObject *__pyx_int_4;
4045
static PyObject *__pyx_int_5;
4046
static PyObject *__pyx_int_8;
4047
static PyObject *__pyx_int_16;
4048
static PyObject *__pyx_int_24;
4049
static PyObject *__pyx_int_36;
4050
static PyObject *__pyx_int_64;
4051
static PyObject *__pyx_int_216;
4052
static PyObject *__pyx_int_432;
4053
static PyObject *__pyx_int_20002;
4054
static PyObject *__pyx_int_neg_27;
4055
static PyObject *__pyx_int_neg_48;
4056
static PyObject *__pyx_int_neg_54;
4057
static PyObject *__pyx_int_neg_64;
4058
static PyObject *__pyx_int_neg_864;
4059
static PyObject *__pyx_int_neg_110592;
4060
static PyObject *__pyx_tuple_;
4061
static PyObject *__pyx_tuple__2;
4062
static PyObject *__pyx_tuple__3;
4063
static PyObject *__pyx_tuple__5;
4064
static PyObject *__pyx_tuple__6;
4065
static PyObject *__pyx_tuple__8;
4066
static PyObject *__pyx_codeobj__4;
4067
static PyObject *__pyx_codeobj__7;
4068
static PyObject *__pyx_codeobj__9;
4069
4070
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":56
4071
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing
4072
*
4073
* cpdef long ap_via_enumeration(ResidueRingElement a4, ResidueRingElement a6) except -1: # <<<<<<<<<<<<<<
4074
* """
4075
* Compute the trace of Frobenius `a_p` on the elliptic curve defined
4076
*/
4077
4078
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_1ap_via_enumeration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4079
static long __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration(struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a4, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a6, CYTHON_UNUSED int __pyx_skip_dispatch) {
4080
long __pyx_v_i;
4081
long __pyx_v_cnt;
4082
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R = 0;
4083
long __pyx_v_p;
4084
CYTHON_UNUSED long __pyx_v_n;
4085
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_x;
4086
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_z;
4087
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_w;
4088
long __pyx_r;
4089
__Pyx_RefNannyDeclarations
4090
PyObject *__pyx_t_1 = NULL;
4091
int __pyx_t_2;
4092
long __pyx_t_3;
4093
long __pyx_t_4;
4094
int __pyx_t_5;
4095
__Pyx_RefNannySetupContext("ap_via_enumeration", 0);
4096
4097
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":77
4098
* 120
4099
* """
4100
* cdef long i, cnt = 1 # point at infinity # <<<<<<<<<<<<<<
4101
* cdef ResidueRing_abstract R = a4.parent()
4102
*
4103
*/
4104
__pyx_v_cnt = 1;
4105
4106
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":78
4107
* """
4108
* cdef long i, cnt = 1 # point at infinity
4109
* cdef ResidueRing_abstract R = a4.parent() # <<<<<<<<<<<<<<
4110
*
4111
* if R.e != 1:
4112
*/
4113
__pyx_t_1 = ((struct __pyx_vtabstruct_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *)__pyx_v_a4->__pyx_vtab)->parent(__pyx_v_a4, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
4114
__Pyx_GOTREF(__pyx_t_1);
4115
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract))))) __PYX_ERR(0, 78, __pyx_L1_error)
4116
__pyx_v_R = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_t_1);
4117
__pyx_t_1 = 0;
4118
4119
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":80
4120
* cdef ResidueRing_abstract R = a4.parent()
4121
*
4122
* if R.e != 1: # <<<<<<<<<<<<<<
4123
* raise ValueError, "residue ring must be a field"
4124
*
4125
*/
4126
__pyx_t_2 = ((__pyx_v_R->e != 1) != 0);
4127
if (__pyx_t_2) {
4128
4129
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":81
4130
*
4131
* if R.e != 1:
4132
* raise ValueError, "residue ring must be a field" # <<<<<<<<<<<<<<
4133
*
4134
* cdef long p = R.p
4135
*/
4136
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_residue_ring_must_be_a_field, 0, 0);
4137
__PYX_ERR(0, 81, __pyx_L1_error)
4138
4139
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":80
4140
* cdef ResidueRing_abstract R = a4.parent()
4141
*
4142
* if R.e != 1: # <<<<<<<<<<<<<<
4143
* raise ValueError, "residue ring must be a field"
4144
*
4145
*/
4146
}
4147
4148
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":83
4149
* raise ValueError, "residue ring must be a field"
4150
*
4151
* cdef long p = R.p # <<<<<<<<<<<<<<
4152
* cdef long n = p*(p-1)/2
4153
* cdef residue_element x, z, w
4154
*/
4155
__pyx_t_3 = __pyx_v_R->p;
4156
__pyx_v_p = __pyx_t_3;
4157
4158
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":84
4159
*
4160
* cdef long p = R.p
4161
* cdef long n = p*(p-1)/2 # <<<<<<<<<<<<<<
4162
* cdef residue_element x, z, w
4163
* for i in range(R.cardinality()):
4164
*/
4165
__pyx_v_n = __Pyx_div_long((__pyx_v_p * (__pyx_v_p - 1)), 2);
4166
4167
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":86
4168
* cdef long n = p*(p-1)/2
4169
* cdef residue_element x, z, w
4170
* for i in range(R.cardinality()): # <<<<<<<<<<<<<<
4171
* R.unsafe_ith_element(x, i)
4172
* R.mul(z, x, x) # z = x*x
4173
*/
4174
__pyx_t_3 = ((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);
4175
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
4176
__pyx_v_i = __pyx_t_4;
4177
4178
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":87
4179
* cdef residue_element x, z, w
4180
* for i in range(R.cardinality()):
4181
* R.unsafe_ith_element(x, i) # <<<<<<<<<<<<<<
4182
* R.mul(z, x, x) # z = x*x
4183
* R.mul(z, z, x) # z = x^3
4184
*/
4185
((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);
4186
4187
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":88
4188
* for i in range(R.cardinality()):
4189
* R.unsafe_ith_element(x, i)
4190
* R.mul(z, x, x) # z = x*x # <<<<<<<<<<<<<<
4191
* R.mul(z, z, x) # z = x^3
4192
* R.mul(w, a4.x, x) # w = a4*x
4193
*/
4194
((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);
4195
4196
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":89
4197
* R.unsafe_ith_element(x, i)
4198
* R.mul(z, x, x) # z = x*x
4199
* R.mul(z, z, x) # z = x^3 # <<<<<<<<<<<<<<
4200
* R.mul(w, a4.x, x) # w = a4*x
4201
* R.add(z, z, w) # z = z + w = x^3 + a4*x
4202
*/
4203
((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);
4204
4205
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":90
4206
* R.mul(z, x, x) # z = x*x
4207
* R.mul(z, z, x) # z = x^3
4208
* R.mul(w, a4.x, x) # w = a4*x # <<<<<<<<<<<<<<
4209
* R.add(z, z, w) # z = z + w = x^3 + a4*x
4210
* R.add(z, z, a6.x) # z = x^3 + a4*x + a6
4211
*/
4212
((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->x, __pyx_v_x);
4213
4214
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":91
4215
* R.mul(z, z, x) # z = x^3
4216
* R.mul(w, a4.x, x) # w = a4*x
4217
* R.add(z, z, w) # z = z + w = x^3 + a4*x # <<<<<<<<<<<<<<
4218
* R.add(z, z, a6.x) # z = x^3 + a4*x + a6
4219
* if R.element_is_0(z):
4220
*/
4221
((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);
4222
4223
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":92
4224
* R.mul(w, a4.x, x) # w = a4*x
4225
* R.add(z, z, w) # z = z + w = x^3 + a4*x
4226
* R.add(z, z, a6.x) # z = x^3 + a4*x + a6 # <<<<<<<<<<<<<<
4227
* if R.element_is_0(z):
4228
* cnt += 1
4229
*/
4230
((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->x);
4231
4232
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":93
4233
* R.add(z, z, w) # z = z + w = x^3 + a4*x
4234
* R.add(z, z, a6.x) # z = x^3 + a4*x + a6
4235
* if R.element_is_0(z): # <<<<<<<<<<<<<<
4236
* cnt += 1
4237
* elif R.is_square(z):
4238
*/
4239
__pyx_t_2 = (((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);
4240
if (__pyx_t_2) {
4241
4242
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":94
4243
* R.add(z, z, a6.x) # z = x^3 + a4*x + a6
4244
* if R.element_is_0(z):
4245
* cnt += 1 # <<<<<<<<<<<<<<
4246
* elif R.is_square(z):
4247
* cnt += 2
4248
*/
4249
__pyx_v_cnt = (__pyx_v_cnt + 1);
4250
4251
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":93
4252
* R.add(z, z, w) # z = z + w = x^3 + a4*x
4253
* R.add(z, z, a6.x) # z = x^3 + a4*x + a6
4254
* if R.element_is_0(z): # <<<<<<<<<<<<<<
4255
* cnt += 1
4256
* elif R.is_square(z):
4257
*/
4258
goto __pyx_L6;
4259
}
4260
4261
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":95
4262
* if R.element_is_0(z):
4263
* cnt += 1
4264
* elif R.is_square(z): # <<<<<<<<<<<<<<
4265
* cnt += 2
4266
* return R.cardinality() + 1 - cnt
4267
*/
4268
__pyx_t_2 = ((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_2 == -2)) __PYX_ERR(0, 95, __pyx_L1_error)
4269
__pyx_t_5 = (__pyx_t_2 != 0);
4270
if (__pyx_t_5) {
4271
4272
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":96
4273
* cnt += 1
4274
* elif R.is_square(z):
4275
* cnt += 2 # <<<<<<<<<<<<<<
4276
* return R.cardinality() + 1 - cnt
4277
*
4278
*/
4279
__pyx_v_cnt = (__pyx_v_cnt + 2);
4280
4281
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":95
4282
* if R.element_is_0(z):
4283
* cnt += 1
4284
* elif R.is_square(z): # <<<<<<<<<<<<<<
4285
* cnt += 2
4286
* return R.cardinality() + 1 - cnt
4287
*/
4288
}
4289
__pyx_L6:;
4290
}
4291
4292
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":97
4293
* elif R.is_square(z):
4294
* cnt += 2
4295
* return R.cardinality() + 1 - cnt # <<<<<<<<<<<<<<
4296
*
4297
* from sage.libs.gmp.mpz cimport (
4298
*/
4299
__pyx_r = ((((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);
4300
goto __pyx_L0;
4301
4302
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":56
4303
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing
4304
*
4305
* cpdef long ap_via_enumeration(ResidueRingElement a4, ResidueRingElement a6) except -1: # <<<<<<<<<<<<<<
4306
* """
4307
* Compute the trace of Frobenius `a_p` on the elliptic curve defined
4308
*/
4309
4310
/* function exit code */
4311
__pyx_L1_error:;
4312
__Pyx_XDECREF(__pyx_t_1);
4313
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.ap_via_enumeration", __pyx_clineno, __pyx_lineno, __pyx_filename);
4314
__pyx_r = -1L;
4315
__pyx_L0:;
4316
__Pyx_XDECREF((PyObject *)__pyx_v_R);
4317
__Pyx_RefNannyFinishContext();
4318
return __pyx_r;
4319
}
4320
4321
/* Python wrapper */
4322
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_1ap_via_enumeration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4323
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration[] = "File: sqrt5.pyx (starting at line 56)\n\n Compute the trace of Frobenius `a_p` on the elliptic curve defined\n by `y^2 = x^3 + a_4 x + a_6` using a straightforward enumeration\n algorithm. Here `p` must be a prime of good reduction for the\n equation of the curve.\n\n EXAMPLES::\n\n sage: import psage.ellcurve.lseries.sqrt5 as s\n sage: K.<a> = NumberField(x^2-x-1)\n sage: E = EllipticCurve([1,-a,a,5*a-4,-3*a+4])\n sage: _,_,_,a4,a6 = E.short_weierstrass_model().a_invariants()\n sage: P = K.ideal(163)\n sage: import psage.modform.hilbert.sqrt5.sqrt5_fast as t\n sage: R = t.ResidueRing(P, 1)\n sage: s.ap_via_enumeration(R(a4), R(a6))\n 120\n sage: k = P.residue_field(); E0 = E.change_ring(k); k.cardinality() + 1 - E0.cardinality()\n 120\n ";
4324
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_1ap_via_enumeration(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4325
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a4 = 0;
4326
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a6 = 0;
4327
PyObject *__pyx_r = 0;
4328
__Pyx_RefNannyDeclarations
4329
__Pyx_RefNannySetupContext("ap_via_enumeration (wrapper)", 0);
4330
{
4331
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a4,&__pyx_n_s_a6,0};
4332
PyObject* values[2] = {0,0};
4333
if (unlikely(__pyx_kwds)) {
4334
Py_ssize_t kw_args;
4335
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4336
switch (pos_args) {
4337
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4338
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4339
case 0: break;
4340
default: goto __pyx_L5_argtuple_error;
4341
}
4342
kw_args = PyDict_Size(__pyx_kwds);
4343
switch (pos_args) {
4344
case 0:
4345
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a4)) != 0)) kw_args--;
4346
else goto __pyx_L5_argtuple_error;
4347
case 1:
4348
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a6)) != 0)) kw_args--;
4349
else {
4350
__Pyx_RaiseArgtupleInvalid("ap_via_enumeration", 1, 2, 2, 1); __PYX_ERR(0, 56, __pyx_L3_error)
4351
}
4352
}
4353
if (unlikely(kw_args > 0)) {
4354
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ap_via_enumeration") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
4355
}
4356
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4357
goto __pyx_L5_argtuple_error;
4358
} else {
4359
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4360
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4361
}
4362
__pyx_v_a4 = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *)values[0]);
4363
__pyx_v_a6 = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *)values[1]);
4364
}
4365
goto __pyx_L4_argument_unpacking_done;
4366
__pyx_L5_argtuple_error:;
4367
__Pyx_RaiseArgtupleInvalid("ap_via_enumeration", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
4368
__pyx_L3_error:;
4369
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.ap_via_enumeration", __pyx_clineno, __pyx_lineno, __pyx_filename);
4370
__Pyx_RefNannyFinishContext();
4371
return NULL;
4372
__pyx_L4_argument_unpacking_done:;
4373
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a4), __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement, 1, "a4", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
4374
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a6), __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement, 1, "a6", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
4375
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration(__pyx_self, __pyx_v_a4, __pyx_v_a6);
4376
4377
/* function exit code */
4378
goto __pyx_L0;
4379
__pyx_L1_error:;
4380
__pyx_r = NULL;
4381
__pyx_L0:;
4382
__Pyx_RefNannyFinishContext();
4383
return __pyx_r;
4384
}
4385
4386
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a4, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_a6) {
4387
PyObject *__pyx_r = NULL;
4388
__Pyx_RefNannyDeclarations
4389
long __pyx_t_1;
4390
PyObject *__pyx_t_2 = NULL;
4391
__Pyx_RefNannySetupContext("ap_via_enumeration", 0);
4392
__Pyx_XDECREF(__pyx_r);
4393
__pyx_t_1 = __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration(__pyx_v_a4, __pyx_v_a6, 0); if (unlikely(__pyx_t_1 == -1L)) __PYX_ERR(0, 56, __pyx_L1_error)
4394
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
4395
__Pyx_GOTREF(__pyx_t_2);
4396
__pyx_r = __pyx_t_2;
4397
__pyx_t_2 = 0;
4398
goto __pyx_L0;
4399
4400
/* function exit code */
4401
__pyx_L1_error:;
4402
__Pyx_XDECREF(__pyx_t_2);
4403
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.ap_via_enumeration", __pyx_clineno, __pyx_lineno, __pyx_filename);
4404
__pyx_r = NULL;
4405
__pyx_L0:;
4406
__Pyx_XGIVEREF(__pyx_r);
4407
__Pyx_RefNannyFinishContext();
4408
return __pyx_r;
4409
}
4410
4411
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":107
4412
* unsigned long Fl_div(unsigned long a, unsigned long b, unsigned long p)
4413
*
4414
* cpdef unsigned long sqrt_mod(unsigned long a, unsigned long p): # <<<<<<<<<<<<<<
4415
* return Fl_sqrt(a, p)
4416
*
4417
*/
4418
4419
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_3sqrt_mod(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4420
static unsigned long __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_sqrt_mod(unsigned long __pyx_v_a, unsigned long __pyx_v_p, CYTHON_UNUSED int __pyx_skip_dispatch) {
4421
unsigned long __pyx_r;
4422
__Pyx_RefNannyDeclarations
4423
__Pyx_RefNannySetupContext("sqrt_mod", 0);
4424
4425
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":108
4426
*
4427
* cpdef unsigned long sqrt_mod(unsigned long a, unsigned long p):
4428
* return Fl_sqrt(a, p) # <<<<<<<<<<<<<<
4429
*
4430
* from sage.rings.integer cimport Integer
4431
*/
4432
__pyx_r = Fl_sqrt(__pyx_v_a, __pyx_v_p);
4433
goto __pyx_L0;
4434
4435
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":107
4436
* unsigned long Fl_div(unsigned long a, unsigned long b, unsigned long p)
4437
*
4438
* cpdef unsigned long sqrt_mod(unsigned long a, unsigned long p): # <<<<<<<<<<<<<<
4439
* return Fl_sqrt(a, p)
4440
*
4441
*/
4442
4443
/* function exit code */
4444
__pyx_L0:;
4445
__Pyx_RefNannyFinishContext();
4446
return __pyx_r;
4447
}
4448
4449
/* Python wrapper */
4450
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_3sqrt_mod(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4451
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_2sqrt_mod[] = "File: sqrt5.pyx (starting at line 107)";
4452
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_3sqrt_mod(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4453
unsigned long __pyx_v_a;
4454
unsigned long __pyx_v_p;
4455
PyObject *__pyx_r = 0;
4456
__Pyx_RefNannyDeclarations
4457
__Pyx_RefNannySetupContext("sqrt_mod (wrapper)", 0);
4458
{
4459
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_p,0};
4460
PyObject* values[2] = {0,0};
4461
if (unlikely(__pyx_kwds)) {
4462
Py_ssize_t kw_args;
4463
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4464
switch (pos_args) {
4465
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4466
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4467
case 0: break;
4468
default: goto __pyx_L5_argtuple_error;
4469
}
4470
kw_args = PyDict_Size(__pyx_kwds);
4471
switch (pos_args) {
4472
case 0:
4473
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
4474
else goto __pyx_L5_argtuple_error;
4475
case 1:
4476
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
4477
else {
4478
__Pyx_RaiseArgtupleInvalid("sqrt_mod", 1, 2, 2, 1); __PYX_ERR(0, 107, __pyx_L3_error)
4479
}
4480
}
4481
if (unlikely(kw_args > 0)) {
4482
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrt_mod") < 0)) __PYX_ERR(0, 107, __pyx_L3_error)
4483
}
4484
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4485
goto __pyx_L5_argtuple_error;
4486
} else {
4487
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4488
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4489
}
4490
__pyx_v_a = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_a == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error)
4491
__pyx_v_p = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error)
4492
}
4493
goto __pyx_L4_argument_unpacking_done;
4494
__pyx_L5_argtuple_error:;
4495
__Pyx_RaiseArgtupleInvalid("sqrt_mod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 107, __pyx_L3_error)
4496
__pyx_L3_error:;
4497
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.sqrt_mod", __pyx_clineno, __pyx_lineno, __pyx_filename);
4498
__Pyx_RefNannyFinishContext();
4499
return NULL;
4500
__pyx_L4_argument_unpacking_done:;
4501
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_2sqrt_mod(__pyx_self, __pyx_v_a, __pyx_v_p);
4502
4503
/* function exit code */
4504
__Pyx_RefNannyFinishContext();
4505
return __pyx_r;
4506
}
4507
4508
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_2sqrt_mod(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_a, unsigned long __pyx_v_p) {
4509
PyObject *__pyx_r = NULL;
4510
__Pyx_RefNannyDeclarations
4511
PyObject *__pyx_t_1 = NULL;
4512
__Pyx_RefNannySetupContext("sqrt_mod", 0);
4513
__Pyx_XDECREF(__pyx_r);
4514
__pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_sqrt_mod(__pyx_v_a, __pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
4515
__Pyx_GOTREF(__pyx_t_1);
4516
__pyx_r = __pyx_t_1;
4517
__pyx_t_1 = 0;
4518
goto __pyx_L0;
4519
4520
/* function exit code */
4521
__pyx_L1_error:;
4522
__Pyx_XDECREF(__pyx_t_1);
4523
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.sqrt_mod", __pyx_clineno, __pyx_lineno, __pyx_filename);
4524
__pyx_r = NULL;
4525
__pyx_L0:;
4526
__Pyx_XGIVEREF(__pyx_r);
4527
__Pyx_RefNannyFinishContext();
4528
return __pyx_r;
4529
}
4530
4531
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":135
4532
* ##########################################################
4533
*
4534
* def __cinit__(self): # <<<<<<<<<<<<<<
4535
* self.primes = NULL
4536
* self.sqrt5 = NULL
4537
*/
4538
4539
/* Python wrapper */
4540
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4541
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4542
int __pyx_r;
4543
__Pyx_RefNannyDeclarations
4544
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
4545
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
4546
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
4547
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
4548
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius___cinit__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self));
4549
4550
/* function exit code */
4551
__Pyx_RefNannyFinishContext();
4552
return __pyx_r;
4553
}
4554
4555
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius___cinit__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self) {
4556
int __pyx_r;
4557
__Pyx_RefNannyDeclarations
4558
__Pyx_RefNannySetupContext("__cinit__", 0);
4559
4560
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":136
4561
*
4562
* def __cinit__(self):
4563
* self.primes = NULL # <<<<<<<<<<<<<<
4564
* self.sqrt5 = NULL
4565
* self.ap = NULL
4566
*/
4567
__pyx_v_self->primes = NULL;
4568
4569
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":137
4570
* def __cinit__(self):
4571
* self.primes = NULL
4572
* self.sqrt5 = NULL # <<<<<<<<<<<<<<
4573
* self.ap = NULL
4574
* mpz_init(self.Ax); mpz_init(self.Ay); mpz_init(self.Bx); mpz_init(self.By)
4575
*/
4576
__pyx_v_self->sqrt5 = NULL;
4577
4578
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":138
4579
* self.primes = NULL
4580
* self.sqrt5 = NULL
4581
* self.ap = NULL # <<<<<<<<<<<<<<
4582
* mpz_init(self.Ax); mpz_init(self.Ay); mpz_init(self.Bx); mpz_init(self.By)
4583
*
4584
*/
4585
__pyx_v_self->ap = NULL;
4586
4587
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":139
4588
* self.sqrt5 = NULL
4589
* self.ap = NULL
4590
* mpz_init(self.Ax); mpz_init(self.Ay); mpz_init(self.Bx); mpz_init(self.By) # <<<<<<<<<<<<<<
4591
*
4592
* def __init__(self, E, long bound):
4593
*/
4594
mpz_init(__pyx_v_self->Ax);
4595
mpz_init(__pyx_v_self->Ay);
4596
mpz_init(__pyx_v_self->Bx);
4597
mpz_init(__pyx_v_self->By);
4598
4599
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":135
4600
* ##########################################################
4601
*
4602
* def __cinit__(self): # <<<<<<<<<<<<<<
4603
* self.primes = NULL
4604
* self.sqrt5 = NULL
4605
*/
4606
4607
/* function exit code */
4608
__pyx_r = 0;
4609
__Pyx_RefNannyFinishContext();
4610
return __pyx_r;
4611
}
4612
4613
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":141
4614
* mpz_init(self.Ax); mpz_init(self.Ay); mpz_init(self.Bx); mpz_init(self.By)
4615
*
4616
* def __init__(self, E, long bound): # <<<<<<<<<<<<<<
4617
* # Make table of primes up to the bound, and uninitialized
4618
* # corresponding a_p (traces of Frobenius)
4619
*/
4620
4621
/* Python wrapper */
4622
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4623
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__[] = "File: sqrt5.pyx (starting at line 141)";
4624
#if CYTHON_COMPILING_IN_CPYTHON
4625
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__;
4626
#endif
4627
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4628
PyObject *__pyx_v_E = 0;
4629
long __pyx_v_bound;
4630
int __pyx_r;
4631
__Pyx_RefNannyDeclarations
4632
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4633
{
4634
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_bound,0};
4635
PyObject* values[2] = {0,0};
4636
if (unlikely(__pyx_kwds)) {
4637
Py_ssize_t kw_args;
4638
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4639
switch (pos_args) {
4640
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4641
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4642
case 0: break;
4643
default: goto __pyx_L5_argtuple_error;
4644
}
4645
kw_args = PyDict_Size(__pyx_kwds);
4646
switch (pos_args) {
4647
case 0:
4648
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
4649
else goto __pyx_L5_argtuple_error;
4650
case 1:
4651
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bound)) != 0)) kw_args--;
4652
else {
4653
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 141, __pyx_L3_error)
4654
}
4655
}
4656
if (unlikely(kw_args > 0)) {
4657
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 141, __pyx_L3_error)
4658
}
4659
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4660
goto __pyx_L5_argtuple_error;
4661
} else {
4662
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4663
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4664
}
4665
__pyx_v_E = values[0];
4666
__pyx_v_bound = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_bound == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error)
4667
}
4668
goto __pyx_L4_argument_unpacking_done;
4669
__pyx_L5_argtuple_error:;
4670
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error)
4671
__pyx_L3_error:;
4672
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4673
__Pyx_RefNannyFinishContext();
4674
return -1;
4675
__pyx_L4_argument_unpacking_done:;
4676
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), __pyx_v_E, __pyx_v_bound);
4677
4678
/* function exit code */
4679
__Pyx_RefNannyFinishContext();
4680
return __pyx_r;
4681
}
4682
4683
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_bound) {
4684
int __pyx_r;
4685
__Pyx_RefNannyDeclarations
4686
PyObject *__pyx_t_1 = NULL;
4687
PyObject *__pyx_t_2 = NULL;
4688
PyObject *__pyx_t_3 = NULL;
4689
PyObject *__pyx_t_4 = NULL;
4690
PyObject *__pyx_t_5 = NULL;
4691
__Pyx_RefNannySetupContext("__init__", 0);
4692
4693
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":144
4694
* # Make table of primes up to the bound, and uninitialized
4695
* # corresponding a_p (traces of Frobenius)
4696
* self._initialize_coefficients(E) # <<<<<<<<<<<<<<
4697
* self._initialize_prime_ap_tables(bound)
4698
* #self._compute_split_traces()
4699
*/
4700
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_initialize_coefficients); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
4701
__Pyx_GOTREF(__pyx_t_2);
4702
__pyx_t_3 = NULL;
4703
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4704
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4705
if (likely(__pyx_t_3)) {
4706
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4707
__Pyx_INCREF(__pyx_t_3);
4708
__Pyx_INCREF(function);
4709
__Pyx_DECREF_SET(__pyx_t_2, function);
4710
}
4711
}
4712
if (!__pyx_t_3) {
4713
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_E); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
4714
__Pyx_GOTREF(__pyx_t_1);
4715
} else {
4716
#if CYTHON_FAST_PYCALL
4717
if (PyFunction_Check(__pyx_t_2)) {
4718
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_E};
4719
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
4720
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4721
__Pyx_GOTREF(__pyx_t_1);
4722
} else
4723
#endif
4724
#if CYTHON_FAST_PYCCALL
4725
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4726
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_E};
4727
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
4728
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4729
__Pyx_GOTREF(__pyx_t_1);
4730
} else
4731
#endif
4732
{
4733
__pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error)
4734
__Pyx_GOTREF(__pyx_t_4);
4735
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
4736
__Pyx_INCREF(__pyx_v_E);
4737
__Pyx_GIVEREF(__pyx_v_E);
4738
PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_E);
4739
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
4740
__Pyx_GOTREF(__pyx_t_1);
4741
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4742
}
4743
}
4744
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4745
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4746
4747
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":145
4748
* # corresponding a_p (traces of Frobenius)
4749
* self._initialize_coefficients(E)
4750
* self._initialize_prime_ap_tables(bound) # <<<<<<<<<<<<<<
4751
* #self._compute_split_traces()
4752
*
4753
*/
4754
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_initialize_prime_ap_tables); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
4755
__Pyx_GOTREF(__pyx_t_2);
4756
__pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_bound); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error)
4757
__Pyx_GOTREF(__pyx_t_4);
4758
__pyx_t_3 = NULL;
4759
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4760
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4761
if (likely(__pyx_t_3)) {
4762
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4763
__Pyx_INCREF(__pyx_t_3);
4764
__Pyx_INCREF(function);
4765
__Pyx_DECREF_SET(__pyx_t_2, function);
4766
}
4767
}
4768
if (!__pyx_t_3) {
4769
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
4770
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4771
__Pyx_GOTREF(__pyx_t_1);
4772
} else {
4773
#if CYTHON_FAST_PYCALL
4774
if (PyFunction_Check(__pyx_t_2)) {
4775
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
4776
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
4777
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4778
__Pyx_GOTREF(__pyx_t_1);
4779
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4780
} else
4781
#endif
4782
#if CYTHON_FAST_PYCCALL
4783
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4784
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
4785
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
4786
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4787
__Pyx_GOTREF(__pyx_t_1);
4788
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4789
} else
4790
#endif
4791
{
4792
__pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error)
4793
__Pyx_GOTREF(__pyx_t_5);
4794
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
4795
__Pyx_GIVEREF(__pyx_t_4);
4796
PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
4797
__pyx_t_4 = 0;
4798
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
4799
__Pyx_GOTREF(__pyx_t_1);
4800
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4801
}
4802
}
4803
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4804
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4805
4806
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":141
4807
* mpz_init(self.Ax); mpz_init(self.Ay); mpz_init(self.Bx); mpz_init(self.By)
4808
*
4809
* def __init__(self, E, long bound): # <<<<<<<<<<<<<<
4810
* # Make table of primes up to the bound, and uninitialized
4811
* # corresponding a_p (traces of Frobenius)
4812
*/
4813
4814
/* function exit code */
4815
__pyx_r = 0;
4816
goto __pyx_L0;
4817
__pyx_L1_error:;
4818
__Pyx_XDECREF(__pyx_t_1);
4819
__Pyx_XDECREF(__pyx_t_2);
4820
__Pyx_XDECREF(__pyx_t_3);
4821
__Pyx_XDECREF(__pyx_t_4);
4822
__Pyx_XDECREF(__pyx_t_5);
4823
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4824
__pyx_r = -1;
4825
__pyx_L0:;
4826
__Pyx_RefNannyFinishContext();
4827
return __pyx_r;
4828
}
4829
4830
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":148
4831
* #self._compute_split_traces()
4832
*
4833
* def _initialize_prime_ap_tables(self, long bound): # <<<<<<<<<<<<<<
4834
* self.bound = bound
4835
* cdef long max_size = 2*bound+20
4836
*/
4837
4838
/* Python wrapper */
4839
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_5_initialize_prime_ap_tables(PyObject *__pyx_v_self, PyObject *__pyx_arg_bound); /*proto*/
4840
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_4_initialize_prime_ap_tables[] = "File: sqrt5.pyx (starting at line 148)";
4841
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_5_initialize_prime_ap_tables(PyObject *__pyx_v_self, PyObject *__pyx_arg_bound) {
4842
long __pyx_v_bound;
4843
PyObject *__pyx_r = 0;
4844
__Pyx_RefNannyDeclarations
4845
__Pyx_RefNannySetupContext("_initialize_prime_ap_tables (wrapper)", 0);
4846
assert(__pyx_arg_bound); {
4847
__pyx_v_bound = __Pyx_PyInt_As_long(__pyx_arg_bound); if (unlikely((__pyx_v_bound == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L3_error)
4848
}
4849
goto __pyx_L4_argument_unpacking_done;
4850
__pyx_L3_error:;
4851
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._initialize_prime_ap_tables", __pyx_clineno, __pyx_lineno, __pyx_filename);
4852
__Pyx_RefNannyFinishContext();
4853
return NULL;
4854
__pyx_L4_argument_unpacking_done:;
4855
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_4_initialize_prime_ap_tables(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), ((long)__pyx_v_bound));
4856
4857
/* function exit code */
4858
__Pyx_RefNannyFinishContext();
4859
return __pyx_r;
4860
}
4861
4862
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_4_initialize_prime_ap_tables(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, long __pyx_v_bound) {
4863
long __pyx_v_max_size;
4864
long __pyx_v_p;
4865
long __pyx_v_t;
4866
long __pyx_v_i;
4867
long __pyx_v_sr0;
4868
long __pyx_v_sr1;
4869
PyObject *__pyx_r = NULL;
4870
__Pyx_RefNannyDeclarations
4871
PyObject *__pyx_t_1 = NULL;
4872
PyObject *__pyx_t_2 = NULL;
4873
PyObject *__pyx_t_3 = NULL;
4874
PyObject *__pyx_t_4 = NULL;
4875
PyObject *__pyx_t_5 = NULL;
4876
Py_ssize_t __pyx_t_6;
4877
PyObject *(*__pyx_t_7)(PyObject *);
4878
long __pyx_t_8;
4879
int __pyx_t_9;
4880
long __pyx_t_10;
4881
int __pyx_t_11;
4882
__Pyx_RefNannySetupContext("_initialize_prime_ap_tables", 0);
4883
4884
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":149
4885
*
4886
* def _initialize_prime_ap_tables(self, long bound):
4887
* self.bound = bound # <<<<<<<<<<<<<<
4888
* cdef long max_size = 2*bound+20
4889
* self.primes = <long*> sage_malloc(sizeof(long)*max_size)
4890
*/
4891
__pyx_v_self->bound = __pyx_v_bound;
4892
4893
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":150
4894
* def _initialize_prime_ap_tables(self, long bound):
4895
* self.bound = bound
4896
* cdef long max_size = 2*bound+20 # <<<<<<<<<<<<<<
4897
* self.primes = <long*> sage_malloc(sizeof(long)*max_size)
4898
* self.sqrt5 = <long*> sage_malloc(sizeof(long)*max_size)
4899
*/
4900
__pyx_v_max_size = ((2 * __pyx_v_bound) + 20);
4901
4902
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":151
4903
* self.bound = bound
4904
* cdef long max_size = 2*bound+20
4905
* self.primes = <long*> sage_malloc(sizeof(long)*max_size) # <<<<<<<<<<<<<<
4906
* self.sqrt5 = <long*> sage_malloc(sizeof(long)*max_size)
4907
* self.ap = <long*> sage_malloc(sizeof(long)*max_size)
4908
*/
4909
__pyx_v_self->primes = ((long *)sig_malloc(((sizeof(long)) * __pyx_v_max_size)));
4910
4911
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":152
4912
* cdef long max_size = 2*bound+20
4913
* self.primes = <long*> sage_malloc(sizeof(long)*max_size)
4914
* self.sqrt5 = <long*> sage_malloc(sizeof(long)*max_size) # <<<<<<<<<<<<<<
4915
* self.ap = <long*> sage_malloc(sizeof(long)*max_size)
4916
*
4917
*/
4918
__pyx_v_self->sqrt5 = ((long *)sig_malloc(((sizeof(long)) * __pyx_v_max_size)));
4919
4920
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":153
4921
* self.primes = <long*> sage_malloc(sizeof(long)*max_size)
4922
* self.sqrt5 = <long*> sage_malloc(sizeof(long)*max_size)
4923
* self.ap = <long*> sage_malloc(sizeof(long)*max_size) # <<<<<<<<<<<<<<
4924
*
4925
* cdef long p, t, i=0, sr0, sr1
4926
*/
4927
__pyx_v_self->ap = ((long *)sig_malloc(((sizeof(long)) * __pyx_v_max_size)));
4928
4929
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":155
4930
* self.ap = <long*> sage_malloc(sizeof(long)*max_size)
4931
*
4932
* cdef long p, t, i=0, sr0, sr1 # <<<<<<<<<<<<<<
4933
* for p in prime_range(bound):
4934
* if i >= max_size:
4935
*/
4936
__pyx_v_i = 0;
4937
4938
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":156
4939
*
4940
* cdef long p, t, i=0, sr0, sr1
4941
* for p in prime_range(bound): # <<<<<<<<<<<<<<
4942
* if i >= max_size:
4943
* raise RuntimeError, "memory assumption violated"
4944
*/
4945
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_prime_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
4946
__Pyx_GOTREF(__pyx_t_2);
4947
__pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_bound); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error)
4948
__Pyx_GOTREF(__pyx_t_3);
4949
__pyx_t_4 = NULL;
4950
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4951
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
4952
if (likely(__pyx_t_4)) {
4953
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4954
__Pyx_INCREF(__pyx_t_4);
4955
__Pyx_INCREF(function);
4956
__Pyx_DECREF_SET(__pyx_t_2, function);
4957
}
4958
}
4959
if (!__pyx_t_4) {
4960
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
4961
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4962
__Pyx_GOTREF(__pyx_t_1);
4963
} else {
4964
#if CYTHON_FAST_PYCALL
4965
if (PyFunction_Check(__pyx_t_2)) {
4966
PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
4967
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
4968
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4969
__Pyx_GOTREF(__pyx_t_1);
4970
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4971
} else
4972
#endif
4973
#if CYTHON_FAST_PYCCALL
4974
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
4975
PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
4976
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
4977
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4978
__Pyx_GOTREF(__pyx_t_1);
4979
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4980
} else
4981
#endif
4982
{
4983
__pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error)
4984
__Pyx_GOTREF(__pyx_t_5);
4985
__Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
4986
__Pyx_GIVEREF(__pyx_t_3);
4987
PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
4988
__pyx_t_3 = 0;
4989
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
4990
__Pyx_GOTREF(__pyx_t_1);
4991
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4992
}
4993
}
4994
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4995
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
4996
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
4997
__pyx_t_7 = NULL;
4998
} else {
4999
__pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
5000
__Pyx_GOTREF(__pyx_t_2);
5001
__pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error)
5002
}
5003
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5004
for (;;) {
5005
if (likely(!__pyx_t_7)) {
5006
if (likely(PyList_CheckExact(__pyx_t_2))) {
5007
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
5008
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5009
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
5010
#else
5011
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
5012
__Pyx_GOTREF(__pyx_t_1);
5013
#endif
5014
} else {
5015
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
5016
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5017
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
5018
#else
5019
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
5020
__Pyx_GOTREF(__pyx_t_1);
5021
#endif
5022
}
5023
} else {
5024
__pyx_t_1 = __pyx_t_7(__pyx_t_2);
5025
if (unlikely(!__pyx_t_1)) {
5026
PyObject* exc_type = PyErr_Occurred();
5027
if (exc_type) {
5028
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5029
else __PYX_ERR(0, 156, __pyx_L1_error)
5030
}
5031
break;
5032
}
5033
__Pyx_GOTREF(__pyx_t_1);
5034
}
5035
__pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error)
5036
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5037
__pyx_v_p = __pyx_t_8;
5038
5039
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":157
5040
* cdef long p, t, i=0, sr0, sr1
5041
* for p in prime_range(bound):
5042
* if i >= max_size: # <<<<<<<<<<<<<<
5043
* raise RuntimeError, "memory assumption violated"
5044
* t = p % 5
5045
*/
5046
__pyx_t_9 = ((__pyx_v_i >= __pyx_v_max_size) != 0);
5047
if (__pyx_t_9) {
5048
5049
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":158
5050
* for p in prime_range(bound):
5051
* if i >= max_size:
5052
* raise RuntimeError, "memory assumption violated" # <<<<<<<<<<<<<<
5053
* t = p % 5
5054
* if t == 1 or t == 4:
5055
*/
5056
__Pyx_Raise(__pyx_builtin_RuntimeError, __pyx_kp_s_memory_assumption_violated, 0, 0);
5057
__PYX_ERR(0, 158, __pyx_L1_error)
5058
5059
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":157
5060
* cdef long p, t, i=0, sr0, sr1
5061
* for p in prime_range(bound):
5062
* if i >= max_size: # <<<<<<<<<<<<<<
5063
* raise RuntimeError, "memory assumption violated"
5064
* t = p % 5
5065
*/
5066
}
5067
5068
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":159
5069
* if i >= max_size:
5070
* raise RuntimeError, "memory assumption violated"
5071
* t = p % 5 # <<<<<<<<<<<<<<
5072
* if t == 1 or t == 4:
5073
* # split case
5074
*/
5075
__pyx_v_t = __Pyx_mod_long(__pyx_v_p, 5);
5076
5077
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":160
5078
* raise RuntimeError, "memory assumption violated"
5079
* t = p % 5
5080
* if t == 1 or t == 4: # <<<<<<<<<<<<<<
5081
* # split case
5082
* self.primes[i] = p
5083
*/
5084
switch (__pyx_v_t) {
5085
case 1:
5086
case 4:
5087
5088
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":162
5089
* if t == 1 or t == 4:
5090
* # split case
5091
* self.primes[i] = p # <<<<<<<<<<<<<<
5092
* self.primes[i+1] = p
5093
* self.ap[i] = UNKNOWN
5094
*/
5095
(__pyx_v_self->primes[__pyx_v_i]) = __pyx_v_p;
5096
5097
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":163
5098
* # split case
5099
* self.primes[i] = p
5100
* self.primes[i+1] = p # <<<<<<<<<<<<<<
5101
* self.ap[i] = UNKNOWN
5102
* self.ap[i+1] = UNKNOWN
5103
*/
5104
(__pyx_v_self->primes[(__pyx_v_i + 1)]) = __pyx_v_p;
5105
5106
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":164
5107
* self.primes[i] = p
5108
* self.primes[i+1] = p
5109
* self.ap[i] = UNKNOWN # <<<<<<<<<<<<<<
5110
* self.ap[i+1] = UNKNOWN
5111
* sr0 = sqrt_mod(5, p)
5112
*/
5113
(__pyx_v_self->ap[__pyx_v_i]) = __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN;
5114
5115
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":165
5116
* self.primes[i+1] = p
5117
* self.ap[i] = UNKNOWN
5118
* self.ap[i+1] = UNKNOWN # <<<<<<<<<<<<<<
5119
* sr0 = sqrt_mod(5, p)
5120
* sr1 = p - sr0
5121
*/
5122
(__pyx_v_self->ap[(__pyx_v_i + 1)]) = __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN;
5123
5124
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":166
5125
* self.ap[i] = UNKNOWN
5126
* self.ap[i+1] = UNKNOWN
5127
* sr0 = sqrt_mod(5, p) # <<<<<<<<<<<<<<
5128
* sr1 = p - sr0
5129
* if sr0 > sr1: # swap
5130
*/
5131
__pyx_v_sr0 = __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_sqrt_mod(5, __pyx_v_p, 0);
5132
5133
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":167
5134
* self.ap[i+1] = UNKNOWN
5135
* sr0 = sqrt_mod(5, p)
5136
* sr1 = p - sr0 # <<<<<<<<<<<<<<
5137
* if sr0 > sr1: # swap
5138
* sr0, sr1 = sr1, sr0
5139
*/
5140
__pyx_v_sr1 = (__pyx_v_p - __pyx_v_sr0);
5141
5142
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":168
5143
* sr0 = sqrt_mod(5, p)
5144
* sr1 = p - sr0
5145
* if sr0 > sr1: # swap # <<<<<<<<<<<<<<
5146
* sr0, sr1 = sr1, sr0
5147
* self.sqrt5[i] = sr0
5148
*/
5149
__pyx_t_9 = ((__pyx_v_sr0 > __pyx_v_sr1) != 0);
5150
if (__pyx_t_9) {
5151
5152
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":169
5153
* sr1 = p - sr0
5154
* if sr0 > sr1: # swap
5155
* sr0, sr1 = sr1, sr0 # <<<<<<<<<<<<<<
5156
* self.sqrt5[i] = sr0
5157
* self.sqrt5[i+1] = sr1
5158
*/
5159
__pyx_t_8 = __pyx_v_sr1;
5160
__pyx_t_10 = __pyx_v_sr0;
5161
__pyx_v_sr0 = __pyx_t_8;
5162
__pyx_v_sr1 = __pyx_t_10;
5163
5164
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":168
5165
* sr0 = sqrt_mod(5, p)
5166
* sr1 = p - sr0
5167
* if sr0 > sr1: # swap # <<<<<<<<<<<<<<
5168
* sr0, sr1 = sr1, sr0
5169
* self.sqrt5[i] = sr0
5170
*/
5171
}
5172
5173
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":170
5174
* if sr0 > sr1: # swap
5175
* sr0, sr1 = sr1, sr0
5176
* self.sqrt5[i] = sr0 # <<<<<<<<<<<<<<
5177
* self.sqrt5[i+1] = sr1
5178
* i += 2
5179
*/
5180
(__pyx_v_self->sqrt5[__pyx_v_i]) = __pyx_v_sr0;
5181
5182
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":171
5183
* sr0, sr1 = sr1, sr0
5184
* self.sqrt5[i] = sr0
5185
* self.sqrt5[i+1] = sr1 # <<<<<<<<<<<<<<
5186
* i += 2
5187
* else:
5188
*/
5189
(__pyx_v_self->sqrt5[(__pyx_v_i + 1)]) = __pyx_v_sr1;
5190
5191
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":172
5192
* self.sqrt5[i] = sr0
5193
* self.sqrt5[i+1] = sr1
5194
* i += 2 # <<<<<<<<<<<<<<
5195
* else:
5196
* # inert or ramified cases (ignore primes with too big norm)
5197
*/
5198
__pyx_v_i = (__pyx_v_i + 2);
5199
5200
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":160
5201
* raise RuntimeError, "memory assumption violated"
5202
* t = p % 5
5203
* if t == 1 or t == 4: # <<<<<<<<<<<<<<
5204
* # split case
5205
* self.primes[i] = p
5206
*/
5207
break;
5208
default:
5209
5210
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":175
5211
* else:
5212
* # inert or ramified cases (ignore primes with too big norm)
5213
* if p == 5 or p*p < bound: # <<<<<<<<<<<<<<
5214
* self.primes[i] = p
5215
* self.sqrt5[i] = 0
5216
*/
5217
__pyx_t_11 = ((__pyx_v_p == 5) != 0);
5218
if (!__pyx_t_11) {
5219
} else {
5220
__pyx_t_9 = __pyx_t_11;
5221
goto __pyx_L8_bool_binop_done;
5222
}
5223
__pyx_t_11 = (((__pyx_v_p * __pyx_v_p) < __pyx_v_bound) != 0);
5224
__pyx_t_9 = __pyx_t_11;
5225
__pyx_L8_bool_binop_done:;
5226
if (__pyx_t_9) {
5227
5228
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":176
5229
* # inert or ramified cases (ignore primes with too big norm)
5230
* if p == 5 or p*p < bound:
5231
* self.primes[i] = p # <<<<<<<<<<<<<<
5232
* self.sqrt5[i] = 0
5233
* self.ap[i] = UNKNOWN
5234
*/
5235
(__pyx_v_self->primes[__pyx_v_i]) = __pyx_v_p;
5236
5237
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":177
5238
* if p == 5 or p*p < bound:
5239
* self.primes[i] = p
5240
* self.sqrt5[i] = 0 # <<<<<<<<<<<<<<
5241
* self.ap[i] = UNKNOWN
5242
* i += 1
5243
*/
5244
(__pyx_v_self->sqrt5[__pyx_v_i]) = 0;
5245
5246
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":178
5247
* self.primes[i] = p
5248
* self.sqrt5[i] = 0
5249
* self.ap[i] = UNKNOWN # <<<<<<<<<<<<<<
5250
* i += 1
5251
*
5252
*/
5253
(__pyx_v_self->ap[__pyx_v_i]) = __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN;
5254
5255
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":179
5256
* self.sqrt5[i] = 0
5257
* self.ap[i] = UNKNOWN
5258
* i += 1 # <<<<<<<<<<<<<<
5259
*
5260
* self.table_size = i
5261
*/
5262
__pyx_v_i = (__pyx_v_i + 1);
5263
5264
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":175
5265
* else:
5266
* # inert or ramified cases (ignore primes with too big norm)
5267
* if p == 5 or p*p < bound: # <<<<<<<<<<<<<<
5268
* self.primes[i] = p
5269
* self.sqrt5[i] = 0
5270
*/
5271
}
5272
break;
5273
}
5274
5275
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":156
5276
*
5277
* cdef long p, t, i=0, sr0, sr1
5278
* for p in prime_range(bound): # <<<<<<<<<<<<<<
5279
* if i >= max_size:
5280
* raise RuntimeError, "memory assumption violated"
5281
*/
5282
}
5283
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5284
5285
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":181
5286
* i += 1
5287
*
5288
* self.table_size = i # <<<<<<<<<<<<<<
5289
*
5290
* def _initialize_coefficients(self,E):
5291
*/
5292
__pyx_v_self->table_size = __pyx_v_i;
5293
5294
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":148
5295
* #self._compute_split_traces()
5296
*
5297
* def _initialize_prime_ap_tables(self, long bound): # <<<<<<<<<<<<<<
5298
* self.bound = bound
5299
* cdef long max_size = 2*bound+20
5300
*/
5301
5302
/* function exit code */
5303
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5304
goto __pyx_L0;
5305
__pyx_L1_error:;
5306
__Pyx_XDECREF(__pyx_t_1);
5307
__Pyx_XDECREF(__pyx_t_2);
5308
__Pyx_XDECREF(__pyx_t_3);
5309
__Pyx_XDECREF(__pyx_t_4);
5310
__Pyx_XDECREF(__pyx_t_5);
5311
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._initialize_prime_ap_tables", __pyx_clineno, __pyx_lineno, __pyx_filename);
5312
__pyx_r = NULL;
5313
__pyx_L0:;
5314
__Pyx_XGIVEREF(__pyx_r);
5315
__Pyx_RefNannyFinishContext();
5316
return __pyx_r;
5317
}
5318
5319
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":183
5320
* self.table_size = i
5321
*
5322
* def _initialize_coefficients(self,E): # <<<<<<<<<<<<<<
5323
* # Store all coefficients -- may be needed for trace of frob mod 2 and 3 and bad primes.
5324
* self.E = E
5325
*/
5326
5327
/* Python wrapper */
5328
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_7_initialize_coefficients(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
5329
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_6_initialize_coefficients[] = "File: sqrt5.pyx (starting at line 183)";
5330
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_7_initialize_coefficients(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
5331
PyObject *__pyx_r = 0;
5332
__Pyx_RefNannyDeclarations
5333
__Pyx_RefNannySetupContext("_initialize_coefficients (wrapper)", 0);
5334
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_6_initialize_coefficients(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), ((PyObject *)__pyx_v_E));
5335
5336
/* function exit code */
5337
__Pyx_RefNannyFinishContext();
5338
return __pyx_r;
5339
}
5340
5341
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_6_initialize_coefficients(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_E) {
5342
PyObject *__pyx_v_a1 = NULL;
5343
PyObject *__pyx_v_a2 = NULL;
5344
PyObject *__pyx_v_a3 = NULL;
5345
PyObject *__pyx_v_a4 = NULL;
5346
PyObject *__pyx_v_a6 = NULL;
5347
PyObject *__pyx_v_b2 = NULL;
5348
PyObject *__pyx_v_b4 = NULL;
5349
PyObject *__pyx_v_b6 = NULL;
5350
PyObject *__pyx_v_c4 = NULL;
5351
PyObject *__pyx_v_c6 = NULL;
5352
PyObject *__pyx_v_A = NULL;
5353
PyObject *__pyx_v_B = NULL;
5354
PyObject *__pyx_v_v = NULL;
5355
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_z = 0;
5356
PyObject *__pyx_r = NULL;
5357
__Pyx_RefNannyDeclarations
5358
PyObject *__pyx_t_1 = NULL;
5359
PyObject *__pyx_t_2 = NULL;
5360
PyObject *__pyx_t_3 = NULL;
5361
PyObject *__pyx_t_4 = NULL;
5362
PyObject *__pyx_t_5 = NULL;
5363
PyObject *__pyx_t_6 = NULL;
5364
PyObject *__pyx_t_7 = NULL;
5365
PyObject *(*__pyx_t_8)(PyObject *);
5366
int __pyx_t_9;
5367
int __pyx_t_10;
5368
__Pyx_RefNannySetupContext("_initialize_coefficients", 0);
5369
5370
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":185
5371
* def _initialize_coefficients(self,E):
5372
* # Store all coefficients -- may be needed for trace of frob mod 2 and 3 and bad primes.
5373
* self.E = E # <<<<<<<<<<<<<<
5374
* a1, a2, a3, a4, a6 = E.a_invariants()
5375
*
5376
*/
5377
__Pyx_INCREF(__pyx_v_E);
5378
__Pyx_GIVEREF(__pyx_v_E);
5379
__Pyx_GOTREF(__pyx_v_self->E);
5380
__Pyx_DECREF(__pyx_v_self->E);
5381
__pyx_v_self->E = __pyx_v_E;
5382
5383
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":186
5384
* # Store all coefficients -- may be needed for trace of frob mod 2 and 3 and bad primes.
5385
* self.E = E
5386
* a1, a2, a3, a4, a6 = E.a_invariants() # <<<<<<<<<<<<<<
5387
*
5388
* # Compute short Weierstrass form directly (for speed purposes)
5389
*/
5390
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_E, __pyx_n_s_a_invariants); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
5391
__Pyx_GOTREF(__pyx_t_2);
5392
__pyx_t_3 = NULL;
5393
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5394
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5395
if (likely(__pyx_t_3)) {
5396
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5397
__Pyx_INCREF(__pyx_t_3);
5398
__Pyx_INCREF(function);
5399
__Pyx_DECREF_SET(__pyx_t_2, function);
5400
}
5401
}
5402
if (__pyx_t_3) {
5403
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
5404
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5405
} else {
5406
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
5407
}
5408
__Pyx_GOTREF(__pyx_t_1);
5409
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5410
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
5411
PyObject* sequence = __pyx_t_1;
5412
#if !CYTHON_COMPILING_IN_PYPY
5413
Py_ssize_t size = Py_SIZE(sequence);
5414
#else
5415
Py_ssize_t size = PySequence_Size(sequence);
5416
#endif
5417
if (unlikely(size != 5)) {
5418
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
5419
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5420
__PYX_ERR(0, 186, __pyx_L1_error)
5421
}
5422
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5423
if (likely(PyTuple_CheckExact(sequence))) {
5424
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
5425
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
5426
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
5427
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
5428
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 4);
5429
} else {
5430
__pyx_t_2 = PyList_GET_ITEM(sequence, 0);
5431
__pyx_t_3 = PyList_GET_ITEM(sequence, 1);
5432
__pyx_t_4 = PyList_GET_ITEM(sequence, 2);
5433
__pyx_t_5 = PyList_GET_ITEM(sequence, 3);
5434
__pyx_t_6 = PyList_GET_ITEM(sequence, 4);
5435
}
5436
__Pyx_INCREF(__pyx_t_2);
5437
__Pyx_INCREF(__pyx_t_3);
5438
__Pyx_INCREF(__pyx_t_4);
5439
__Pyx_INCREF(__pyx_t_5);
5440
__Pyx_INCREF(__pyx_t_6);
5441
#else
5442
{
5443
Py_ssize_t i;
5444
PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
5445
for (i=0; i < 5; i++) {
5446
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 186, __pyx_L1_error)
5447
__Pyx_GOTREF(item);
5448
*(temps[i]) = item;
5449
}
5450
}
5451
#endif
5452
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5453
} else {
5454
Py_ssize_t index = -1;
5455
PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6};
5456
__pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 186, __pyx_L1_error)
5457
__Pyx_GOTREF(__pyx_t_7);
5458
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5459
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
5460
for (index=0; index < 5; index++) {
5461
PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
5462
__Pyx_GOTREF(item);
5463
*(temps[index]) = item;
5464
}
5465
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 5) < 0) __PYX_ERR(0, 186, __pyx_L1_error)
5466
__pyx_t_8 = NULL;
5467
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5468
goto __pyx_L4_unpacking_done;
5469
__pyx_L3_unpacking_failed:;
5470
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5471
__pyx_t_8 = NULL;
5472
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
5473
__PYX_ERR(0, 186, __pyx_L1_error)
5474
__pyx_L4_unpacking_done:;
5475
}
5476
__pyx_v_a1 = __pyx_t_2;
5477
__pyx_t_2 = 0;
5478
__pyx_v_a2 = __pyx_t_3;
5479
__pyx_t_3 = 0;
5480
__pyx_v_a3 = __pyx_t_4;
5481
__pyx_t_4 = 0;
5482
__pyx_v_a4 = __pyx_t_5;
5483
__pyx_t_5 = 0;
5484
__pyx_v_a6 = __pyx_t_6;
5485
__pyx_t_6 = 0;
5486
5487
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":189
5488
*
5489
* # Compute short Weierstrass form directly (for speed purposes)
5490
* if a1 or a2 or a3: # <<<<<<<<<<<<<<
5491
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
5492
* if b2:
5493
*/
5494
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_a1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
5495
if (!__pyx_t_10) {
5496
} else {
5497
__pyx_t_9 = __pyx_t_10;
5498
goto __pyx_L6_bool_binop_done;
5499
}
5500
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_a2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
5501
if (!__pyx_t_10) {
5502
} else {
5503
__pyx_t_9 = __pyx_t_10;
5504
goto __pyx_L6_bool_binop_done;
5505
}
5506
__pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_a3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
5507
__pyx_t_9 = __pyx_t_10;
5508
__pyx_L6_bool_binop_done:;
5509
if (__pyx_t_9) {
5510
5511
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":190
5512
* # Compute short Weierstrass form directly (for speed purposes)
5513
* if a1 or a2 or a3:
5514
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6 # <<<<<<<<<<<<<<
5515
* if b2:
5516
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
5517
*/
5518
__pyx_t_1 = PyNumber_Multiply(__pyx_v_a1, __pyx_v_a1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
5519
__Pyx_GOTREF(__pyx_t_1);
5520
__pyx_t_6 = PyNumber_Multiply(__pyx_int_4, __pyx_v_a2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error)
5521
__Pyx_GOTREF(__pyx_t_6);
5522
__pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
5523
__Pyx_GOTREF(__pyx_t_5);
5524
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5525
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5526
__pyx_v_b2 = __pyx_t_5;
5527
__pyx_t_5 = 0;
5528
__pyx_t_5 = PyNumber_Multiply(__pyx_v_a1, __pyx_v_a3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
5529
__Pyx_GOTREF(__pyx_t_5);
5530
__pyx_t_6 = PyNumber_Multiply(__pyx_int_2, __pyx_v_a4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error)
5531
__Pyx_GOTREF(__pyx_t_6);
5532
__pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
5533
__Pyx_GOTREF(__pyx_t_1);
5534
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5535
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5536
__pyx_v_b4 = __pyx_t_1;
5537
__pyx_t_1 = 0;
5538
__pyx_t_1 = PyNumber_Power(__pyx_v_a3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
5539
__Pyx_GOTREF(__pyx_t_1);
5540
__pyx_t_6 = PyNumber_Multiply(__pyx_int_4, __pyx_v_a6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error)
5541
__Pyx_GOTREF(__pyx_t_6);
5542
__pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
5543
__Pyx_GOTREF(__pyx_t_5);
5544
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5545
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5546
__pyx_v_b6 = __pyx_t_5;
5547
__pyx_t_5 = 0;
5548
5549
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":191
5550
* if a1 or a2 or a3:
5551
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
5552
* if b2: # <<<<<<<<<<<<<<
5553
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
5554
* A = -27*c4; B = -54*c6
5555
*/
5556
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_b2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 191, __pyx_L1_error)
5557
if (__pyx_t_9) {
5558
5559
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":192
5560
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
5561
* if b2:
5562
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6 # <<<<<<<<<<<<<<
5563
* A = -27*c4; B = -54*c6
5564
* else:
5565
*/
5566
__pyx_t_5 = PyNumber_Power(__pyx_v_b2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
5567
__Pyx_GOTREF(__pyx_t_5);
5568
__pyx_t_6 = PyNumber_Multiply(__pyx_int_24, __pyx_v_b4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5569
__Pyx_GOTREF(__pyx_t_6);
5570
__pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
5571
__Pyx_GOTREF(__pyx_t_1);
5572
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5573
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5574
__pyx_v_c4 = __pyx_t_1;
5575
__pyx_t_1 = 0;
5576
__pyx_t_1 = PyNumber_Power(__pyx_v_b2, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
5577
__Pyx_GOTREF(__pyx_t_1);
5578
__pyx_t_6 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5579
__Pyx_GOTREF(__pyx_t_6);
5580
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5581
__pyx_t_1 = PyNumber_Multiply(__pyx_int_36, __pyx_v_b2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
5582
__Pyx_GOTREF(__pyx_t_1);
5583
__pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_b4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
5584
__Pyx_GOTREF(__pyx_t_5);
5585
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5586
__pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
5587
__Pyx_GOTREF(__pyx_t_1);
5588
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5589
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5590
__pyx_t_5 = PyNumber_Multiply(__pyx_int_216, __pyx_v_b6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
5591
__Pyx_GOTREF(__pyx_t_5);
5592
__pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error)
5593
__Pyx_GOTREF(__pyx_t_6);
5594
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5595
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5596
__pyx_v_c6 = __pyx_t_6;
5597
__pyx_t_6 = 0;
5598
5599
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":193
5600
* if b2:
5601
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
5602
* A = -27*c4; B = -54*c6 # <<<<<<<<<<<<<<
5603
* else:
5604
* A = 8*b4; B = 16*b6
5605
*/
5606
__pyx_t_6 = PyNumber_Multiply(__pyx_int_neg_27, __pyx_v_c4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
5607
__Pyx_GOTREF(__pyx_t_6);
5608
__pyx_v_A = __pyx_t_6;
5609
__pyx_t_6 = 0;
5610
__pyx_t_6 = PyNumber_Multiply(__pyx_int_neg_54, __pyx_v_c6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 193, __pyx_L1_error)
5611
__Pyx_GOTREF(__pyx_t_6);
5612
__pyx_v_B = __pyx_t_6;
5613
__pyx_t_6 = 0;
5614
5615
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":191
5616
* if a1 or a2 or a3:
5617
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
5618
* if b2: # <<<<<<<<<<<<<<
5619
* c4 = b2**2 - 24*b4; c6 = -b2**3 + 36*b2*b4 - 216*b6
5620
* A = -27*c4; B = -54*c6
5621
*/
5622
goto __pyx_L9;
5623
}
5624
5625
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":195
5626
* A = -27*c4; B = -54*c6
5627
* else:
5628
* A = 8*b4; B = 16*b6 # <<<<<<<<<<<<<<
5629
* else:
5630
* A = a4; B = a6
5631
*/
5632
/*else*/ {
5633
__pyx_t_6 = PyNumber_Multiply(__pyx_int_8, __pyx_v_b4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error)
5634
__Pyx_GOTREF(__pyx_t_6);
5635
__pyx_v_A = __pyx_t_6;
5636
__pyx_t_6 = 0;
5637
__pyx_t_6 = PyNumber_Multiply(__pyx_int_16, __pyx_v_b6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error)
5638
__Pyx_GOTREF(__pyx_t_6);
5639
__pyx_v_B = __pyx_t_6;
5640
__pyx_t_6 = 0;
5641
}
5642
__pyx_L9:;
5643
5644
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":189
5645
*
5646
* # Compute short Weierstrass form directly (for speed purposes)
5647
* if a1 or a2 or a3: # <<<<<<<<<<<<<<
5648
* b2 = a1*a1 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3**2 + 4*a6
5649
* if b2:
5650
*/
5651
goto __pyx_L5;
5652
}
5653
5654
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":197
5655
* A = 8*b4; B = 16*b6
5656
* else:
5657
* A = a4; B = a6 # <<<<<<<<<<<<<<
5658
*
5659
* # Now do the change of variables y|-->y/8; x|-->x/4 to get an isomorphic
5660
*/
5661
/*else*/ {
5662
__Pyx_INCREF(__pyx_v_a4);
5663
__pyx_v_A = __pyx_v_a4;
5664
__Pyx_INCREF(__pyx_v_a6);
5665
__pyx_v_B = __pyx_v_a6;
5666
}
5667
__pyx_L5:;
5668
5669
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":202
5670
* # curve so that A and B are in Z[sqrt(5)], and the reduction isn't
5671
* # any worse at 2.
5672
* A *= 16 # <<<<<<<<<<<<<<
5673
* B *= 64
5674
*
5675
*/
5676
__pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_A, __pyx_int_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
5677
__Pyx_GOTREF(__pyx_t_6);
5678
__Pyx_DECREF_SET(__pyx_v_A, __pyx_t_6);
5679
__pyx_t_6 = 0;
5680
5681
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":203
5682
* # any worse at 2.
5683
* A *= 16
5684
* B *= 64 # <<<<<<<<<<<<<<
5685
*
5686
* self.c_quo = (-48*A)/(-864*B)
5687
*/
5688
__pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_B, __pyx_int_64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
5689
__Pyx_GOTREF(__pyx_t_6);
5690
__Pyx_DECREF_SET(__pyx_v_B, __pyx_t_6);
5691
__pyx_t_6 = 0;
5692
5693
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":205
5694
* B *= 64
5695
*
5696
* self.c_quo = (-48*A)/(-864*B) # <<<<<<<<<<<<<<
5697
* self.j = (-110592*A*A*A)/(-64*A*A*A - 432*B*B)
5698
*
5699
*/
5700
__pyx_t_6 = PyNumber_Multiply(__pyx_int_neg_48, __pyx_v_A); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error)
5701
__Pyx_GOTREF(__pyx_t_6);
5702
__pyx_t_5 = PyNumber_Multiply(__pyx_int_neg_864, __pyx_v_B); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
5703
__Pyx_GOTREF(__pyx_t_5);
5704
__pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
5705
__Pyx_GOTREF(__pyx_t_1);
5706
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5707
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5708
__Pyx_GIVEREF(__pyx_t_1);
5709
__Pyx_GOTREF(__pyx_v_self->c_quo);
5710
__Pyx_DECREF(__pyx_v_self->c_quo);
5711
__pyx_v_self->c_quo = __pyx_t_1;
5712
__pyx_t_1 = 0;
5713
5714
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":206
5715
*
5716
* self.c_quo = (-48*A)/(-864*B)
5717
* self.j = (-110592*A*A*A)/(-64*A*A*A - 432*B*B) # <<<<<<<<<<<<<<
5718
*
5719
* # Store the short Weierstrass form coefficients as a 4-tuple of GMP ints,
5720
*/
5721
__pyx_t_1 = PyNumber_Multiply(__pyx_int_neg_110592, __pyx_v_A); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
5722
__Pyx_GOTREF(__pyx_t_1);
5723
__pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_A); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error)
5724
__Pyx_GOTREF(__pyx_t_5);
5725
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5726
__pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_A); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
5727
__Pyx_GOTREF(__pyx_t_1);
5728
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5729
__pyx_t_5 = PyNumber_Multiply(__pyx_int_neg_64, __pyx_v_A); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error)
5730
__Pyx_GOTREF(__pyx_t_5);
5731
__pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_v_A); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
5732
__Pyx_GOTREF(__pyx_t_6);
5733
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5734
__pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_v_A); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error)
5735
__Pyx_GOTREF(__pyx_t_5);
5736
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5737
__pyx_t_6 = PyNumber_Multiply(__pyx_int_432, __pyx_v_B); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
5738
__Pyx_GOTREF(__pyx_t_6);
5739
__pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_v_B); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
5740
__Pyx_GOTREF(__pyx_t_4);
5741
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5742
__pyx_t_6 = PyNumber_Subtract(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
5743
__Pyx_GOTREF(__pyx_t_6);
5744
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5745
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5746
__pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
5747
__Pyx_GOTREF(__pyx_t_4);
5748
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5749
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5750
__Pyx_GIVEREF(__pyx_t_4);
5751
__Pyx_GOTREF(__pyx_v_self->j);
5752
__Pyx_DECREF(__pyx_v_self->j);
5753
__pyx_v_self->j = __pyx_t_4;
5754
__pyx_t_4 = 0;
5755
5756
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":215
5757
* # presently, non-quadratic number field elements don't have a
5758
* # parts method, which is a safety check.
5759
* v = A.parts() # <<<<<<<<<<<<<<
5760
* cdef Integer z
5761
* z = Integer(v[0]); mpz_set(self.Ax, z.value)
5762
*/
5763
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_parts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __pyx_L1_error)
5764
__Pyx_GOTREF(__pyx_t_6);
5765
__pyx_t_1 = NULL;
5766
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
5767
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
5768
if (likely(__pyx_t_1)) {
5769
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5770
__Pyx_INCREF(__pyx_t_1);
5771
__Pyx_INCREF(function);
5772
__Pyx_DECREF_SET(__pyx_t_6, function);
5773
}
5774
}
5775
if (__pyx_t_1) {
5776
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
5777
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5778
} else {
5779
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
5780
}
5781
__Pyx_GOTREF(__pyx_t_4);
5782
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5783
__pyx_v_v = __pyx_t_4;
5784
__pyx_t_4 = 0;
5785
5786
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":217
5787
* v = A.parts()
5788
* cdef Integer z
5789
* z = Integer(v[0]); mpz_set(self.Ax, z.value) # <<<<<<<<<<<<<<
5790
* z = Integer(v[1]); mpz_set(self.Ay, z.value)
5791
* v = B.parts()
5792
*/
5793
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
5794
__Pyx_GOTREF(__pyx_t_4);
5795
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error)
5796
__Pyx_GOTREF(__pyx_t_6);
5797
__Pyx_GIVEREF(__pyx_t_4);
5798
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
5799
__pyx_t_4 = 0;
5800
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
5801
__Pyx_GOTREF(__pyx_t_4);
5802
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5803
__pyx_v_z = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_4);
5804
__pyx_t_4 = 0;
5805
mpz_set(__pyx_v_self->Ax, __pyx_v_z->value);
5806
5807
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":218
5808
* cdef Integer z
5809
* z = Integer(v[0]); mpz_set(self.Ax, z.value)
5810
* z = Integer(v[1]); mpz_set(self.Ay, z.value) # <<<<<<<<<<<<<<
5811
* v = B.parts()
5812
* z = Integer(v[0]); mpz_set(self.Bx, z.value)
5813
*/
5814
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_v, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error)
5815
__Pyx_GOTREF(__pyx_t_4);
5816
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error)
5817
__Pyx_GOTREF(__pyx_t_6);
5818
__Pyx_GIVEREF(__pyx_t_4);
5819
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
5820
__pyx_t_4 = 0;
5821
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error)
5822
__Pyx_GOTREF(__pyx_t_4);
5823
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5824
__Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_4));
5825
__pyx_t_4 = 0;
5826
mpz_set(__pyx_v_self->Ay, __pyx_v_z->value);
5827
5828
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":219
5829
* z = Integer(v[0]); mpz_set(self.Ax, z.value)
5830
* z = Integer(v[1]); mpz_set(self.Ay, z.value)
5831
* v = B.parts() # <<<<<<<<<<<<<<
5832
* z = Integer(v[0]); mpz_set(self.Bx, z.value)
5833
* z = Integer(v[1]); mpz_set(self.By, z.value)
5834
*/
5835
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_B, __pyx_n_s_parts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __pyx_L1_error)
5836
__Pyx_GOTREF(__pyx_t_6);
5837
__pyx_t_1 = NULL;
5838
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
5839
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
5840
if (likely(__pyx_t_1)) {
5841
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5842
__Pyx_INCREF(__pyx_t_1);
5843
__Pyx_INCREF(function);
5844
__Pyx_DECREF_SET(__pyx_t_6, function);
5845
}
5846
}
5847
if (__pyx_t_1) {
5848
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error)
5849
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5850
} else {
5851
__pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error)
5852
}
5853
__Pyx_GOTREF(__pyx_t_4);
5854
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5855
__Pyx_DECREF_SET(__pyx_v_v, __pyx_t_4);
5856
__pyx_t_4 = 0;
5857
5858
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":220
5859
* z = Integer(v[1]); mpz_set(self.Ay, z.value)
5860
* v = B.parts()
5861
* z = Integer(v[0]); mpz_set(self.Bx, z.value) # <<<<<<<<<<<<<<
5862
* z = Integer(v[1]); mpz_set(self.By, z.value)
5863
*
5864
*/
5865
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
5866
__Pyx_GOTREF(__pyx_t_4);
5867
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error)
5868
__Pyx_GOTREF(__pyx_t_6);
5869
__Pyx_GIVEREF(__pyx_t_4);
5870
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
5871
__pyx_t_4 = 0;
5872
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
5873
__Pyx_GOTREF(__pyx_t_4);
5874
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5875
__Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_4));
5876
__pyx_t_4 = 0;
5877
mpz_set(__pyx_v_self->Bx, __pyx_v_z->value);
5878
5879
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":221
5880
* v = B.parts()
5881
* z = Integer(v[0]); mpz_set(self.Bx, z.value)
5882
* z = Integer(v[1]); mpz_set(self.By, z.value) # <<<<<<<<<<<<<<
5883
*
5884
* def __dealloc__(self):
5885
*/
5886
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_v, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
5887
__Pyx_GOTREF(__pyx_t_4);
5888
__pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error)
5889
__Pyx_GOTREF(__pyx_t_6);
5890
__Pyx_GIVEREF(__pyx_t_4);
5891
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
5892
__pyx_t_4 = 0;
5893
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
5894
__Pyx_GOTREF(__pyx_t_4);
5895
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5896
__Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_4sage_5rings_7integer_Integer *)__pyx_t_4));
5897
__pyx_t_4 = 0;
5898
mpz_set(__pyx_v_self->By, __pyx_v_z->value);
5899
5900
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":183
5901
* self.table_size = i
5902
*
5903
* def _initialize_coefficients(self,E): # <<<<<<<<<<<<<<
5904
* # Store all coefficients -- may be needed for trace of frob mod 2 and 3 and bad primes.
5905
* self.E = E
5906
*/
5907
5908
/* function exit code */
5909
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
5910
goto __pyx_L0;
5911
__pyx_L1_error:;
5912
__Pyx_XDECREF(__pyx_t_1);
5913
__Pyx_XDECREF(__pyx_t_2);
5914
__Pyx_XDECREF(__pyx_t_3);
5915
__Pyx_XDECREF(__pyx_t_4);
5916
__Pyx_XDECREF(__pyx_t_5);
5917
__Pyx_XDECREF(__pyx_t_6);
5918
__Pyx_XDECREF(__pyx_t_7);
5919
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._initialize_coefficients", __pyx_clineno, __pyx_lineno, __pyx_filename);
5920
__pyx_r = NULL;
5921
__pyx_L0:;
5922
__Pyx_XDECREF(__pyx_v_a1);
5923
__Pyx_XDECREF(__pyx_v_a2);
5924
__Pyx_XDECREF(__pyx_v_a3);
5925
__Pyx_XDECREF(__pyx_v_a4);
5926
__Pyx_XDECREF(__pyx_v_a6);
5927
__Pyx_XDECREF(__pyx_v_b2);
5928
__Pyx_XDECREF(__pyx_v_b4);
5929
__Pyx_XDECREF(__pyx_v_b6);
5930
__Pyx_XDECREF(__pyx_v_c4);
5931
__Pyx_XDECREF(__pyx_v_c6);
5932
__Pyx_XDECREF(__pyx_v_A);
5933
__Pyx_XDECREF(__pyx_v_B);
5934
__Pyx_XDECREF(__pyx_v_v);
5935
__Pyx_XDECREF((PyObject *)__pyx_v_z);
5936
__Pyx_XGIVEREF(__pyx_r);
5937
__Pyx_RefNannyFinishContext();
5938
return __pyx_r;
5939
}
5940
5941
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":223
5942
* z = Integer(v[1]); mpz_set(self.By, z.value)
5943
*
5944
* def __dealloc__(self): # <<<<<<<<<<<<<<
5945
* mpz_clear(self.Ax); mpz_clear(self.Ay); mpz_clear(self.Bx); mpz_clear(self.By)
5946
* if self.primes:
5947
*/
5948
5949
/* Python wrapper */
5950
static void __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_9__dealloc__(PyObject *__pyx_v_self); /*proto*/
5951
static void __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_9__dealloc__(PyObject *__pyx_v_self) {
5952
__Pyx_RefNannyDeclarations
5953
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
5954
__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_8__dealloc__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self));
5955
5956
/* function exit code */
5957
__Pyx_RefNannyFinishContext();
5958
}
5959
5960
static void __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_8__dealloc__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self) {
5961
__Pyx_RefNannyDeclarations
5962
int __pyx_t_1;
5963
__Pyx_RefNannySetupContext("__dealloc__", 0);
5964
5965
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":224
5966
*
5967
* def __dealloc__(self):
5968
* mpz_clear(self.Ax); mpz_clear(self.Ay); mpz_clear(self.Bx); mpz_clear(self.By) # <<<<<<<<<<<<<<
5969
* if self.primes:
5970
* sage_free(self.primes)
5971
*/
5972
mpz_clear(__pyx_v_self->Ax);
5973
mpz_clear(__pyx_v_self->Ay);
5974
mpz_clear(__pyx_v_self->Bx);
5975
mpz_clear(__pyx_v_self->By);
5976
5977
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":225
5978
* def __dealloc__(self):
5979
* mpz_clear(self.Ax); mpz_clear(self.Ay); mpz_clear(self.Bx); mpz_clear(self.By)
5980
* if self.primes: # <<<<<<<<<<<<<<
5981
* sage_free(self.primes)
5982
* if self.sqrt5:
5983
*/
5984
__pyx_t_1 = (__pyx_v_self->primes != 0);
5985
if (__pyx_t_1) {
5986
5987
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":226
5988
* mpz_clear(self.Ax); mpz_clear(self.Ay); mpz_clear(self.Bx); mpz_clear(self.By)
5989
* if self.primes:
5990
* sage_free(self.primes) # <<<<<<<<<<<<<<
5991
* if self.sqrt5:
5992
* sage_free(self.sqrt5)
5993
*/
5994
sig_free(__pyx_v_self->primes);
5995
5996
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":225
5997
* def __dealloc__(self):
5998
* mpz_clear(self.Ax); mpz_clear(self.Ay); mpz_clear(self.Bx); mpz_clear(self.By)
5999
* if self.primes: # <<<<<<<<<<<<<<
6000
* sage_free(self.primes)
6001
* if self.sqrt5:
6002
*/
6003
}
6004
6005
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":227
6006
* if self.primes:
6007
* sage_free(self.primes)
6008
* if self.sqrt5: # <<<<<<<<<<<<<<
6009
* sage_free(self.sqrt5)
6010
* if self.ap:
6011
*/
6012
__pyx_t_1 = (__pyx_v_self->sqrt5 != 0);
6013
if (__pyx_t_1) {
6014
6015
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":228
6016
* sage_free(self.primes)
6017
* if self.sqrt5:
6018
* sage_free(self.sqrt5) # <<<<<<<<<<<<<<
6019
* if self.ap:
6020
* sage_free(self.ap)
6021
*/
6022
sig_free(__pyx_v_self->sqrt5);
6023
6024
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":227
6025
* if self.primes:
6026
* sage_free(self.primes)
6027
* if self.sqrt5: # <<<<<<<<<<<<<<
6028
* sage_free(self.sqrt5)
6029
* if self.ap:
6030
*/
6031
}
6032
6033
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":229
6034
* if self.sqrt5:
6035
* sage_free(self.sqrt5)
6036
* if self.ap: # <<<<<<<<<<<<<<
6037
* sage_free(self.ap)
6038
*
6039
*/
6040
__pyx_t_1 = (__pyx_v_self->ap != 0);
6041
if (__pyx_t_1) {
6042
6043
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":230
6044
* sage_free(self.sqrt5)
6045
* if self.ap:
6046
* sage_free(self.ap) # <<<<<<<<<<<<<<
6047
*
6048
* def _tables(self):
6049
*/
6050
sig_free(__pyx_v_self->ap);
6051
6052
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":229
6053
* if self.sqrt5:
6054
* sage_free(self.sqrt5)
6055
* if self.ap: # <<<<<<<<<<<<<<
6056
* sage_free(self.ap)
6057
*
6058
*/
6059
}
6060
6061
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":223
6062
* z = Integer(v[1]); mpz_set(self.By, z.value)
6063
*
6064
* def __dealloc__(self): # <<<<<<<<<<<<<<
6065
* mpz_clear(self.Ax); mpz_clear(self.Ay); mpz_clear(self.Bx); mpz_clear(self.By)
6066
* if self.primes:
6067
*/
6068
6069
/* function exit code */
6070
__Pyx_RefNannyFinishContext();
6071
}
6072
6073
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":232
6074
* sage_free(self.ap)
6075
*
6076
* def _tables(self): # <<<<<<<<<<<<<<
6077
* """
6078
* Return Python dictionary with copies of the internal tables.
6079
*/
6080
6081
/* Python wrapper */
6082
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_11_tables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6083
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_10_tables[] = "File: sqrt5.pyx (starting at line 232)\n\n Return Python dictionary with copies of the internal tables.\n This is used mainly for debugging.\n\n OUTPUT:\n - dictionary {'primes':primes, 'sqrt5':sqrt5, 'ap':ap}\n ";
6084
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_11_tables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6085
PyObject *__pyx_r = 0;
6086
__Pyx_RefNannyDeclarations
6087
__Pyx_RefNannySetupContext("_tables (wrapper)", 0);
6088
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_10_tables(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self));
6089
6090
/* function exit code */
6091
__Pyx_RefNannyFinishContext();
6092
return __pyx_r;
6093
}
6094
6095
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_10_tables(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self) {
6096
long __pyx_v_i;
6097
PyObject *__pyx_v_primes = NULL;
6098
PyObject *__pyx_v_sqrt5 = NULL;
6099
PyObject *__pyx_v_ap = NULL;
6100
PyObject *__pyx_r = NULL;
6101
__Pyx_RefNannyDeclarations
6102
PyObject *__pyx_t_1 = NULL;
6103
long __pyx_t_2;
6104
long __pyx_t_3;
6105
PyObject *__pyx_t_4 = NULL;
6106
PyObject *__pyx_t_5 = NULL;
6107
__Pyx_RefNannySetupContext("_tables", 0);
6108
6109
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":241
6110
* """
6111
* cdef long i
6112
* primes = [self.primes[i] for i in range(self.table_size)] # <<<<<<<<<<<<<<
6113
* sqrt5 = [self.sqrt5[i] for i in range(self.table_size)]
6114
* ap = [self.ap[i] if self.ap[i] != UNKNOWN else None for i in range(self.table_size)]
6115
*/
6116
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
6117
__Pyx_GOTREF(__pyx_t_1);
6118
__pyx_t_2 = __pyx_v_self->table_size;
6119
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6120
__pyx_v_i = __pyx_t_3;
6121
__pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_self->primes[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 241, __pyx_L1_error)
6122
__Pyx_GOTREF(__pyx_t_4);
6123
if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 241, __pyx_L1_error)
6124
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6125
}
6126
__pyx_v_primes = ((PyObject*)__pyx_t_1);
6127
__pyx_t_1 = 0;
6128
6129
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":242
6130
* cdef long i
6131
* primes = [self.primes[i] for i in range(self.table_size)]
6132
* sqrt5 = [self.sqrt5[i] for i in range(self.table_size)] # <<<<<<<<<<<<<<
6133
* ap = [self.ap[i] if self.ap[i] != UNKNOWN else None for i in range(self.table_size)]
6134
* return {'primes':primes, 'sqrt5':sqrt5, 'ap':ap}
6135
*/
6136
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
6137
__Pyx_GOTREF(__pyx_t_1);
6138
__pyx_t_2 = __pyx_v_self->table_size;
6139
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6140
__pyx_v_i = __pyx_t_3;
6141
__pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_self->sqrt5[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
6142
__Pyx_GOTREF(__pyx_t_4);
6143
if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 242, __pyx_L1_error)
6144
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6145
}
6146
__pyx_v_sqrt5 = ((PyObject*)__pyx_t_1);
6147
__pyx_t_1 = 0;
6148
6149
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":243
6150
* primes = [self.primes[i] for i in range(self.table_size)]
6151
* sqrt5 = [self.sqrt5[i] for i in range(self.table_size)]
6152
* ap = [self.ap[i] if self.ap[i] != UNKNOWN else None for i in range(self.table_size)] # <<<<<<<<<<<<<<
6153
* return {'primes':primes, 'sqrt5':sqrt5, 'ap':ap}
6154
*
6155
*/
6156
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
6157
__Pyx_GOTREF(__pyx_t_1);
6158
__pyx_t_2 = __pyx_v_self->table_size;
6159
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6160
__pyx_v_i = __pyx_t_3;
6161
if ((((__pyx_v_self->ap[__pyx_v_i]) != __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN) != 0)) {
6162
__pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_self->ap[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 243, __pyx_L1_error)
6163
__Pyx_GOTREF(__pyx_t_5);
6164
__pyx_t_4 = __pyx_t_5;
6165
__pyx_t_5 = 0;
6166
} else {
6167
__Pyx_INCREF(Py_None);
6168
__pyx_t_4 = Py_None;
6169
}
6170
if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 243, __pyx_L1_error)
6171
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6172
}
6173
__pyx_v_ap = ((PyObject*)__pyx_t_1);
6174
__pyx_t_1 = 0;
6175
6176
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":244
6177
* sqrt5 = [self.sqrt5[i] for i in range(self.table_size)]
6178
* ap = [self.ap[i] if self.ap[i] != UNKNOWN else None for i in range(self.table_size)]
6179
* return {'primes':primes, 'sqrt5':sqrt5, 'ap':ap} # <<<<<<<<<<<<<<
6180
*
6181
* def aplist(self):
6182
*/
6183
__Pyx_XDECREF(__pyx_r);
6184
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
6185
__Pyx_GOTREF(__pyx_t_1);
6186
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_primes, __pyx_v_primes) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
6187
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sqrt5, __pyx_v_sqrt5) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
6188
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ap, __pyx_v_ap) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
6189
__pyx_r = __pyx_t_1;
6190
__pyx_t_1 = 0;
6191
goto __pyx_L0;
6192
6193
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":232
6194
* sage_free(self.ap)
6195
*
6196
* def _tables(self): # <<<<<<<<<<<<<<
6197
* """
6198
* Return Python dictionary with copies of the internal tables.
6199
*/
6200
6201
/* function exit code */
6202
__pyx_L1_error:;
6203
__Pyx_XDECREF(__pyx_t_1);
6204
__Pyx_XDECREF(__pyx_t_4);
6205
__Pyx_XDECREF(__pyx_t_5);
6206
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._tables", __pyx_clineno, __pyx_lineno, __pyx_filename);
6207
__pyx_r = NULL;
6208
__pyx_L0:;
6209
__Pyx_XDECREF(__pyx_v_primes);
6210
__Pyx_XDECREF(__pyx_v_sqrt5);
6211
__Pyx_XDECREF(__pyx_v_ap);
6212
__Pyx_XGIVEREF(__pyx_r);
6213
__Pyx_RefNannyFinishContext();
6214
return __pyx_r;
6215
}
6216
6217
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":246
6218
* return {'primes':primes, 'sqrt5':sqrt5, 'ap':ap}
6219
*
6220
* def aplist(self): # <<<<<<<<<<<<<<
6221
* cdef long i
6222
* v = []
6223
*/
6224
6225
/* Python wrapper */
6226
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_13aplist(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6227
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_12aplist[] = "File: sqrt5.pyx (starting at line 246)";
6228
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_13aplist(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6229
PyObject *__pyx_r = 0;
6230
__Pyx_RefNannyDeclarations
6231
__Pyx_RefNannySetupContext("aplist (wrapper)", 0);
6232
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_12aplist(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self));
6233
6234
/* function exit code */
6235
__Pyx_RefNannyFinishContext();
6236
return __pyx_r;
6237
}
6238
6239
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_12aplist(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self) {
6240
long __pyx_v_i;
6241
PyObject *__pyx_v_v = NULL;
6242
PyObject *__pyx_r = NULL;
6243
__Pyx_RefNannyDeclarations
6244
PyObject *__pyx_t_1 = NULL;
6245
long __pyx_t_2;
6246
long __pyx_t_3;
6247
PyObject *__pyx_t_4 = NULL;
6248
PyObject *__pyx_t_5 = NULL;
6249
PyObject *__pyx_t_6 = NULL;
6250
int __pyx_t_7;
6251
__Pyx_RefNannySetupContext("aplist", 0);
6252
6253
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":248
6254
* def aplist(self):
6255
* cdef long i
6256
* v = [] # <<<<<<<<<<<<<<
6257
* for i in range(self.table_size):
6258
* v.append( (self.primes[i], self.sqrt5[i], self.ap[i] if self.ap[i] != UNKNOWN else None) )
6259
*/
6260
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
6261
__Pyx_GOTREF(__pyx_t_1);
6262
__pyx_v_v = ((PyObject*)__pyx_t_1);
6263
__pyx_t_1 = 0;
6264
6265
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":249
6266
* cdef long i
6267
* v = []
6268
* for i in range(self.table_size): # <<<<<<<<<<<<<<
6269
* v.append( (self.primes[i], self.sqrt5[i], self.ap[i] if self.ap[i] != UNKNOWN else None) )
6270
* return v
6271
*/
6272
__pyx_t_2 = __pyx_v_self->table_size;
6273
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6274
__pyx_v_i = __pyx_t_3;
6275
6276
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":250
6277
* v = []
6278
* for i in range(self.table_size):
6279
* v.append( (self.primes[i], self.sqrt5[i], self.ap[i] if self.ap[i] != UNKNOWN else None) ) # <<<<<<<<<<<<<<
6280
* return v
6281
*
6282
*/
6283
__pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->primes[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
6284
__Pyx_GOTREF(__pyx_t_1);
6285
__pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_self->sqrt5[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
6286
__Pyx_GOTREF(__pyx_t_4);
6287
if ((((__pyx_v_self->ap[__pyx_v_i]) != __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN) != 0)) {
6288
__pyx_t_6 = __Pyx_PyInt_From_long((__pyx_v_self->ap[__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
6289
__Pyx_GOTREF(__pyx_t_6);
6290
__pyx_t_5 = __pyx_t_6;
6291
__pyx_t_6 = 0;
6292
} else {
6293
__Pyx_INCREF(Py_None);
6294
__pyx_t_5 = Py_None;
6295
}
6296
__pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
6297
__Pyx_GOTREF(__pyx_t_6);
6298
__Pyx_GIVEREF(__pyx_t_1);
6299
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
6300
__Pyx_GIVEREF(__pyx_t_4);
6301
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
6302
__Pyx_GIVEREF(__pyx_t_5);
6303
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
6304
__pyx_t_1 = 0;
6305
__pyx_t_4 = 0;
6306
__pyx_t_5 = 0;
6307
__pyx_t_7 = __Pyx_PyList_Append(__pyx_v_v, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 250, __pyx_L1_error)
6308
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6309
}
6310
6311
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":251
6312
* for i in range(self.table_size):
6313
* v.append( (self.primes[i], self.sqrt5[i], self.ap[i] if self.ap[i] != UNKNOWN else None) )
6314
* return v # <<<<<<<<<<<<<<
6315
*
6316
* ##########################################################
6317
*/
6318
__Pyx_XDECREF(__pyx_r);
6319
__Pyx_INCREF(__pyx_v_v);
6320
__pyx_r = __pyx_v_v;
6321
goto __pyx_L0;
6322
6323
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":246
6324
* return {'primes':primes, 'sqrt5':sqrt5, 'ap':ap}
6325
*
6326
* def aplist(self): # <<<<<<<<<<<<<<
6327
* cdef long i
6328
* v = []
6329
*/
6330
6331
/* function exit code */
6332
__pyx_L1_error:;
6333
__Pyx_XDECREF(__pyx_t_1);
6334
__Pyx_XDECREF(__pyx_t_4);
6335
__Pyx_XDECREF(__pyx_t_5);
6336
__Pyx_XDECREF(__pyx_t_6);
6337
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius.aplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
6338
__pyx_r = NULL;
6339
__pyx_L0:;
6340
__Pyx_XDECREF(__pyx_v_v);
6341
__Pyx_XGIVEREF(__pyx_r);
6342
__Pyx_RefNannyFinishContext();
6343
return __pyx_r;
6344
}
6345
6346
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":256
6347
* # Compute traces
6348
* ##########################################################
6349
* def _compute_split_traces(self, algorithm='smalljac'): # <<<<<<<<<<<<<<
6350
* cdef long i, p, a, b
6351
* for i in range(self.table_size):
6352
*/
6353
6354
/* Python wrapper */
6355
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_15_compute_split_traces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6356
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_14_compute_split_traces[] = "File: sqrt5.pyx (starting at line 256)";
6357
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_15_compute_split_traces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6358
PyObject *__pyx_v_algorithm = 0;
6359
PyObject *__pyx_r = 0;
6360
__Pyx_RefNannyDeclarations
6361
__Pyx_RefNannySetupContext("_compute_split_traces (wrapper)", 0);
6362
{
6363
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_algorithm,0};
6364
PyObject* values[1] = {0};
6365
values[0] = ((PyObject *)__pyx_n_s_smalljac);
6366
if (unlikely(__pyx_kwds)) {
6367
Py_ssize_t kw_args;
6368
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6369
switch (pos_args) {
6370
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6371
case 0: break;
6372
default: goto __pyx_L5_argtuple_error;
6373
}
6374
kw_args = PyDict_Size(__pyx_kwds);
6375
switch (pos_args) {
6376
case 0:
6377
if (kw_args > 0) {
6378
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algorithm);
6379
if (value) { values[0] = value; kw_args--; }
6380
}
6381
}
6382
if (unlikely(kw_args > 0)) {
6383
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_compute_split_traces") < 0)) __PYX_ERR(0, 256, __pyx_L3_error)
6384
}
6385
} else {
6386
switch (PyTuple_GET_SIZE(__pyx_args)) {
6387
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6388
case 0: break;
6389
default: goto __pyx_L5_argtuple_error;
6390
}
6391
}
6392
__pyx_v_algorithm = values[0];
6393
}
6394
goto __pyx_L4_argument_unpacking_done;
6395
__pyx_L5_argtuple_error:;
6396
__Pyx_RaiseArgtupleInvalid("_compute_split_traces", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 256, __pyx_L3_error)
6397
__pyx_L3_error:;
6398
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_split_traces", __pyx_clineno, __pyx_lineno, __pyx_filename);
6399
__Pyx_RefNannyFinishContext();
6400
return NULL;
6401
__pyx_L4_argument_unpacking_done:;
6402
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_14_compute_split_traces(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), __pyx_v_algorithm);
6403
6404
/* function exit code */
6405
__Pyx_RefNannyFinishContext();
6406
return __pyx_r;
6407
}
6408
6409
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_14_compute_split_traces(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_algorithm) {
6410
long __pyx_v_i;
6411
long __pyx_v_p;
6412
long __pyx_v_a;
6413
long __pyx_v_b;
6414
PyObject *__pyx_r = NULL;
6415
__Pyx_RefNannyDeclarations
6416
long __pyx_t_1;
6417
long __pyx_t_2;
6418
int __pyx_t_3;
6419
long __pyx_t_4;
6420
long __pyx_t_5;
6421
PyObject *__pyx_t_6 = NULL;
6422
PyObject *__pyx_t_7 = NULL;
6423
PyObject *__pyx_t_8 = NULL;
6424
PyObject *__pyx_t_9 = NULL;
6425
PyObject *__pyx_t_10 = NULL;
6426
PyObject *__pyx_t_11 = NULL;
6427
int __pyx_t_12;
6428
PyObject *__pyx_t_13 = NULL;
6429
__Pyx_RefNannySetupContext("_compute_split_traces", 0);
6430
6431
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":258
6432
* def _compute_split_traces(self, algorithm='smalljac'):
6433
* cdef long i, p, a, b
6434
* for i in range(self.table_size): # <<<<<<<<<<<<<<
6435
* if self.sqrt5[i] != 0:
6436
* p = self.primes[i]
6437
*/
6438
__pyx_t_1 = __pyx_v_self->table_size;
6439
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
6440
__pyx_v_i = __pyx_t_2;
6441
6442
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":259
6443
* cdef long i, p, a, b
6444
* for i in range(self.table_size):
6445
* if self.sqrt5[i] != 0: # <<<<<<<<<<<<<<
6446
* p = self.primes[i]
6447
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
6448
*/
6449
__pyx_t_3 = (((__pyx_v_self->sqrt5[__pyx_v_i]) != 0) != 0);
6450
if (__pyx_t_3) {
6451
6452
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":260
6453
* for i in range(self.table_size):
6454
* if self.sqrt5[i] != 0:
6455
* p = self.primes[i] # <<<<<<<<<<<<<<
6456
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
6457
* a = mpz_fdiv_ui(self.Ax, p) + mpz_fdiv_ui(self.Ay, p)*self.sqrt5[i]
6458
*/
6459
__pyx_v_p = (__pyx_v_self->primes[__pyx_v_i]);
6460
6461
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":262
6462
* p = self.primes[i]
6463
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
6464
* a = mpz_fdiv_ui(self.Ax, p) + mpz_fdiv_ui(self.Ay, p)*self.sqrt5[i] # <<<<<<<<<<<<<<
6465
* b = mpz_fdiv_ui(self.Bx, p) + mpz_fdiv_ui(self.By, p)*self.sqrt5[i]
6466
*
6467
*/
6468
__pyx_v_a = (mpz_fdiv_ui(__pyx_v_self->Ax, __pyx_v_p) + (mpz_fdiv_ui(__pyx_v_self->Ay, __pyx_v_p) * (__pyx_v_self->sqrt5[__pyx_v_i])));
6469
6470
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":263
6471
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
6472
* a = mpz_fdiv_ui(self.Ax, p) + mpz_fdiv_ui(self.Ay, p)*self.sqrt5[i]
6473
* b = mpz_fdiv_ui(self.Bx, p) + mpz_fdiv_ui(self.By, p)*self.sqrt5[i] # <<<<<<<<<<<<<<
6474
*
6475
* # 2. Check that the resulting curve is nonsingular
6476
*/
6477
__pyx_v_b = (mpz_fdiv_ui(__pyx_v_self->Bx, __pyx_v_p) + (mpz_fdiv_ui(__pyx_v_self->By, __pyx_v_p) * (__pyx_v_self->sqrt5[__pyx_v_i])));
6478
6479
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":266
6480
*
6481
* # 2. Check that the resulting curve is nonsingular
6482
* if (-64*((a*a) % p) *a - 432*b*b)%p == 0: # <<<<<<<<<<<<<<
6483
* # curve is singular at p -- leave this to some other algorithm
6484
* #print "p = %s singular"%p
6485
*/
6486
__pyx_t_4 = (__pyx_v_a * __pyx_v_a);
6487
if (unlikely(__pyx_v_p == 0)) {
6488
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
6489
__PYX_ERR(0, 266, __pyx_L1_error)
6490
}
6491
__pyx_t_5 = (((-64L * __Pyx_mod_long(__pyx_t_4, __pyx_v_p)) * __pyx_v_a) - ((0x1B0 * __pyx_v_b) * __pyx_v_b));
6492
if (unlikely(__pyx_v_p == 0)) {
6493
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
6494
__PYX_ERR(0, 266, __pyx_L1_error)
6495
}
6496
__pyx_t_3 = ((__Pyx_mod_long(__pyx_t_5, __pyx_v_p) == 0) != 0);
6497
if (__pyx_t_3) {
6498
6499
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":269
6500
* # curve is singular at p -- leave this to some other algorithm
6501
* #print "p = %s singular"%p
6502
* continue # <<<<<<<<<<<<<<
6503
*
6504
* # 3. Compute the trace using smalljac (or PARI?)
6505
*/
6506
goto __pyx_L3_continue;
6507
6508
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":266
6509
*
6510
* # 2. Check that the resulting curve is nonsingular
6511
* if (-64*((a*a) % p) *a - 432*b*b)%p == 0: # <<<<<<<<<<<<<<
6512
* # curve is singular at p -- leave this to some other algorithm
6513
* #print "p = %s singular"%p
6514
*/
6515
}
6516
6517
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":272
6518
*
6519
* # 3. Compute the trace using smalljac (or PARI?)
6520
* if algorithm == 'smalljac': # <<<<<<<<<<<<<<
6521
* self.ap[i] = elliptic_curve_ap(a, b, p)
6522
* elif algorithm == 'pari':
6523
*/
6524
__pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_algorithm, __pyx_n_s_smalljac, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 272, __pyx_L1_error)
6525
if (__pyx_t_3) {
6526
6527
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":273
6528
* # 3. Compute the trace using smalljac (or PARI?)
6529
* if algorithm == 'smalljac':
6530
* self.ap[i] = elliptic_curve_ap(a, b, p) # <<<<<<<<<<<<<<
6531
* elif algorithm == 'pari':
6532
* self.ap[i] = pari('ellap(ellinit([0,0,0,%s,%s],1),%s)'%(a,b,p)) # the 1 in the elliptic curve constructor is super important!
6533
*/
6534
__pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_elliptic_curve_ap); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 273, __pyx_L1_error)
6535
__Pyx_GOTREF(__pyx_t_7);
6536
__pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_a); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 273, __pyx_L1_error)
6537
__Pyx_GOTREF(__pyx_t_8);
6538
__pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_b); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 273, __pyx_L1_error)
6539
__Pyx_GOTREF(__pyx_t_9);
6540
__pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 273, __pyx_L1_error)
6541
__Pyx_GOTREF(__pyx_t_10);
6542
__pyx_t_11 = NULL;
6543
__pyx_t_12 = 0;
6544
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
6545
__pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
6546
if (likely(__pyx_t_11)) {
6547
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6548
__Pyx_INCREF(__pyx_t_11);
6549
__Pyx_INCREF(function);
6550
__Pyx_DECREF_SET(__pyx_t_7, function);
6551
__pyx_t_12 = 1;
6552
}
6553
}
6554
#if CYTHON_FAST_PYCALL
6555
if (PyFunction_Check(__pyx_t_7)) {
6556
PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_8, __pyx_t_9, __pyx_t_10};
6557
__pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 273, __pyx_L1_error)
6558
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
6559
__Pyx_GOTREF(__pyx_t_6);
6560
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6561
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6562
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6563
} else
6564
#endif
6565
#if CYTHON_FAST_PYCCALL
6566
if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
6567
PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_8, __pyx_t_9, __pyx_t_10};
6568
__pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 273, __pyx_L1_error)
6569
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
6570
__Pyx_GOTREF(__pyx_t_6);
6571
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6572
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6573
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6574
} else
6575
#endif
6576
{
6577
__pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 273, __pyx_L1_error)
6578
__Pyx_GOTREF(__pyx_t_13);
6579
if (__pyx_t_11) {
6580
__Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
6581
}
6582
__Pyx_GIVEREF(__pyx_t_8);
6583
PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_8);
6584
__Pyx_GIVEREF(__pyx_t_9);
6585
PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_9);
6586
__Pyx_GIVEREF(__pyx_t_10);
6587
PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_10);
6588
__pyx_t_8 = 0;
6589
__pyx_t_9 = 0;
6590
__pyx_t_10 = 0;
6591
__pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 273, __pyx_L1_error)
6592
__Pyx_GOTREF(__pyx_t_6);
6593
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6594
}
6595
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6596
__pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error)
6597
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6598
(__pyx_v_self->ap[__pyx_v_i]) = __pyx_t_5;
6599
6600
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":272
6601
*
6602
* # 3. Compute the trace using smalljac (or PARI?)
6603
* if algorithm == 'smalljac': # <<<<<<<<<<<<<<
6604
* self.ap[i] = elliptic_curve_ap(a, b, p)
6605
* elif algorithm == 'pari':
6606
*/
6607
goto __pyx_L7;
6608
}
6609
6610
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":274
6611
* if algorithm == 'smalljac':
6612
* self.ap[i] = elliptic_curve_ap(a, b, p)
6613
* elif algorithm == 'pari': # <<<<<<<<<<<<<<
6614
* self.ap[i] = pari('ellap(ellinit([0,0,0,%s,%s],1),%s)'%(a,b,p)) # the 1 in the elliptic curve constructor is super important!
6615
* else:
6616
*/
6617
__pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_algorithm, __pyx_n_s_pari, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 274, __pyx_L1_error)
6618
if (__pyx_t_3) {
6619
6620
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":275
6621
* self.ap[i] = elliptic_curve_ap(a, b, p)
6622
* elif algorithm == 'pari':
6623
* self.ap[i] = pari('ellap(ellinit([0,0,0,%s,%s],1),%s)'%(a,b,p)) # the 1 in the elliptic curve constructor is super important! # <<<<<<<<<<<<<<
6624
* else:
6625
* raise ValueError
6626
*/
6627
__pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_pari); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 275, __pyx_L1_error)
6628
__Pyx_GOTREF(__pyx_t_7);
6629
__pyx_t_13 = __Pyx_PyInt_From_long(__pyx_v_a); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 275, __pyx_L1_error)
6630
__Pyx_GOTREF(__pyx_t_13);
6631
__pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_b); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 275, __pyx_L1_error)
6632
__Pyx_GOTREF(__pyx_t_10);
6633
__pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 275, __pyx_L1_error)
6634
__Pyx_GOTREF(__pyx_t_9);
6635
__pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 275, __pyx_L1_error)
6636
__Pyx_GOTREF(__pyx_t_8);
6637
__Pyx_GIVEREF(__pyx_t_13);
6638
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13);
6639
__Pyx_GIVEREF(__pyx_t_10);
6640
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
6641
__Pyx_GIVEREF(__pyx_t_9);
6642
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9);
6643
__pyx_t_13 = 0;
6644
__pyx_t_10 = 0;
6645
__pyx_t_9 = 0;
6646
__pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_ellap_ellinit_0_0_0_s_s_1_s, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 275, __pyx_L1_error)
6647
__Pyx_GOTREF(__pyx_t_9);
6648
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6649
__pyx_t_8 = NULL;
6650
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
6651
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
6652
if (likely(__pyx_t_8)) {
6653
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
6654
__Pyx_INCREF(__pyx_t_8);
6655
__Pyx_INCREF(function);
6656
__Pyx_DECREF_SET(__pyx_t_7, function);
6657
}
6658
}
6659
if (!__pyx_t_8) {
6660
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error)
6661
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6662
__Pyx_GOTREF(__pyx_t_6);
6663
} else {
6664
#if CYTHON_FAST_PYCALL
6665
if (PyFunction_Check(__pyx_t_7)) {
6666
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
6667
__pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error)
6668
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6669
__Pyx_GOTREF(__pyx_t_6);
6670
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6671
} else
6672
#endif
6673
#if CYTHON_FAST_PYCCALL
6674
if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
6675
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
6676
__pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error)
6677
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6678
__Pyx_GOTREF(__pyx_t_6);
6679
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6680
} else
6681
#endif
6682
{
6683
__pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 275, __pyx_L1_error)
6684
__Pyx_GOTREF(__pyx_t_10);
6685
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
6686
__Pyx_GIVEREF(__pyx_t_9);
6687
PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_9);
6688
__pyx_t_9 = 0;
6689
__pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 275, __pyx_L1_error)
6690
__Pyx_GOTREF(__pyx_t_6);
6691
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6692
}
6693
}
6694
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6695
__pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L1_error)
6696
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6697
(__pyx_v_self->ap[__pyx_v_i]) = __pyx_t_5;
6698
6699
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":274
6700
* if algorithm == 'smalljac':
6701
* self.ap[i] = elliptic_curve_ap(a, b, p)
6702
* elif algorithm == 'pari': # <<<<<<<<<<<<<<
6703
* self.ap[i] = pari('ellap(ellinit([0,0,0,%s,%s],1),%s)'%(a,b,p)) # the 1 in the elliptic curve constructor is super important!
6704
* else:
6705
*/
6706
goto __pyx_L7;
6707
}
6708
6709
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":277
6710
* self.ap[i] = pari('ellap(ellinit([0,0,0,%s,%s],1),%s)'%(a,b,p)) # the 1 in the elliptic curve constructor is super important!
6711
* else:
6712
* raise ValueError # <<<<<<<<<<<<<<
6713
*
6714
* def _compute_inert_and_ramified_traces(self, T): # T = InertTraceCalculator
6715
*/
6716
/*else*/ {
6717
__Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
6718
__PYX_ERR(0, 277, __pyx_L1_error)
6719
}
6720
__pyx_L7:;
6721
6722
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":259
6723
* cdef long i, p, a, b
6724
* for i in range(self.table_size):
6725
* if self.sqrt5[i] != 0: # <<<<<<<<<<<<<<
6726
* p = self.primes[i]
6727
* # 1. Reduce A, B modulo the prime to get a curve over GF(p)
6728
*/
6729
}
6730
__pyx_L3_continue:;
6731
}
6732
6733
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":256
6734
* # Compute traces
6735
* ##########################################################
6736
* def _compute_split_traces(self, algorithm='smalljac'): # <<<<<<<<<<<<<<
6737
* cdef long i, p, a, b
6738
* for i in range(self.table_size):
6739
*/
6740
6741
/* function exit code */
6742
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
6743
goto __pyx_L0;
6744
__pyx_L1_error:;
6745
__Pyx_XDECREF(__pyx_t_6);
6746
__Pyx_XDECREF(__pyx_t_7);
6747
__Pyx_XDECREF(__pyx_t_8);
6748
__Pyx_XDECREF(__pyx_t_9);
6749
__Pyx_XDECREF(__pyx_t_10);
6750
__Pyx_XDECREF(__pyx_t_11);
6751
__Pyx_XDECREF(__pyx_t_13);
6752
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_split_traces", __pyx_clineno, __pyx_lineno, __pyx_filename);
6753
__pyx_r = NULL;
6754
__pyx_L0:;
6755
__Pyx_XGIVEREF(__pyx_r);
6756
__Pyx_RefNannyFinishContext();
6757
return __pyx_r;
6758
}
6759
6760
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":279
6761
* raise ValueError
6762
*
6763
* def _compute_inert_and_ramified_traces(self, T): # T = InertTraceCalculator # <<<<<<<<<<<<<<
6764
* cdef long i, p
6765
* for i in range(self.table_size):
6766
*/
6767
6768
/* Python wrapper */
6769
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_17_compute_inert_and_ramified_traces(PyObject *__pyx_v_self, PyObject *__pyx_v_T); /*proto*/
6770
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_16_compute_inert_and_ramified_traces[] = "File: sqrt5.pyx (starting at line 279)";
6771
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_17_compute_inert_and_ramified_traces(PyObject *__pyx_v_self, PyObject *__pyx_v_T) {
6772
PyObject *__pyx_r = 0;
6773
__Pyx_RefNannyDeclarations
6774
__Pyx_RefNannySetupContext("_compute_inert_and_ramified_traces (wrapper)", 0);
6775
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_16_compute_inert_and_ramified_traces(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), ((PyObject *)__pyx_v_T));
6776
6777
/* function exit code */
6778
__Pyx_RefNannyFinishContext();
6779
return __pyx_r;
6780
}
6781
6782
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_16_compute_inert_and_ramified_traces(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_T) {
6783
long __pyx_v_i;
6784
long __pyx_v_p;
6785
PyObject *__pyx_v_msg = NULL;
6786
PyObject *__pyx_r = NULL;
6787
__Pyx_RefNannyDeclarations
6788
long __pyx_t_1;
6789
long __pyx_t_2;
6790
int __pyx_t_3;
6791
PyObject *__pyx_t_4 = NULL;
6792
PyObject *__pyx_t_5 = NULL;
6793
PyObject *__pyx_t_6 = NULL;
6794
PyObject *__pyx_t_7 = NULL;
6795
PyObject *__pyx_t_8 = NULL;
6796
PyObject *__pyx_t_9 = NULL;
6797
PyObject *__pyx_t_10 = NULL;
6798
int __pyx_t_11;
6799
PyObject *__pyx_t_12 = NULL;
6800
long __pyx_t_13;
6801
PyObject *__pyx_t_14 = NULL;
6802
PyObject *__pyx_t_15 = NULL;
6803
PyObject *__pyx_t_16 = NULL;
6804
__Pyx_RefNannySetupContext("_compute_inert_and_ramified_traces", 0);
6805
6806
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":281
6807
* def _compute_inert_and_ramified_traces(self, T): # T = InertTraceCalculator
6808
* cdef long i, p
6809
* for i in range(self.table_size): # <<<<<<<<<<<<<<
6810
* if self.sqrt5[i] == 0:
6811
* p = self.primes[i]
6812
*/
6813
__pyx_t_1 = __pyx_v_self->table_size;
6814
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
6815
__pyx_v_i = __pyx_t_2;
6816
6817
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":282
6818
* cdef long i, p
6819
* for i in range(self.table_size):
6820
* if self.sqrt5[i] == 0: # <<<<<<<<<<<<<<
6821
* p = self.primes[i]
6822
* if p >= 7:
6823
*/
6824
__pyx_t_3 = (((__pyx_v_self->sqrt5[__pyx_v_i]) == 0) != 0);
6825
if (__pyx_t_3) {
6826
6827
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":283
6828
* for i in range(self.table_size):
6829
* if self.sqrt5[i] == 0:
6830
* p = self.primes[i] # <<<<<<<<<<<<<<
6831
* if p >= 7:
6832
* try:
6833
*/
6834
__pyx_v_p = (__pyx_v_self->primes[__pyx_v_i]);
6835
6836
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":284
6837
* if self.sqrt5[i] == 0:
6838
* p = self.primes[i]
6839
* if p >= 7: # <<<<<<<<<<<<<<
6840
* try:
6841
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
6842
*/
6843
__pyx_t_3 = ((__pyx_v_p >= 7) != 0);
6844
if (__pyx_t_3) {
6845
6846
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":285
6847
* p = self.primes[i]
6848
* if p >= 7:
6849
* try: # <<<<<<<<<<<<<<
6850
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
6851
* except Exception, msg:
6852
*/
6853
{
6854
__Pyx_PyThreadState_declare
6855
__Pyx_PyThreadState_assign
6856
__Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
6857
__Pyx_XGOTREF(__pyx_t_4);
6858
__Pyx_XGOTREF(__pyx_t_5);
6859
__Pyx_XGOTREF(__pyx_t_6);
6860
/*try:*/ {
6861
6862
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":286
6863
* if p >= 7:
6864
* try:
6865
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p) # <<<<<<<<<<<<<<
6866
* except Exception, msg:
6867
* if get_verbose() > 0:
6868
*/
6869
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_T, __pyx_n_s_trace_of_frobenius); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 286, __pyx_L7_error)
6870
__Pyx_GOTREF(__pyx_t_8);
6871
__pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 286, __pyx_L7_error)
6872
__Pyx_GOTREF(__pyx_t_9);
6873
__pyx_t_10 = NULL;
6874
__pyx_t_11 = 0;
6875
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
6876
__pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
6877
if (likely(__pyx_t_10)) {
6878
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
6879
__Pyx_INCREF(__pyx_t_10);
6880
__Pyx_INCREF(function);
6881
__Pyx_DECREF_SET(__pyx_t_8, function);
6882
__pyx_t_11 = 1;
6883
}
6884
}
6885
#if CYTHON_FAST_PYCALL
6886
if (PyFunction_Check(__pyx_t_8)) {
6887
PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_self->j, __pyx_v_self->c_quo, __pyx_t_9};
6888
__pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L7_error)
6889
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6890
__Pyx_GOTREF(__pyx_t_7);
6891
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6892
} else
6893
#endif
6894
#if CYTHON_FAST_PYCCALL
6895
if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
6896
PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_self->j, __pyx_v_self->c_quo, __pyx_t_9};
6897
__pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L7_error)
6898
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6899
__Pyx_GOTREF(__pyx_t_7);
6900
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6901
} else
6902
#endif
6903
{
6904
__pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 286, __pyx_L7_error)
6905
__Pyx_GOTREF(__pyx_t_12);
6906
if (__pyx_t_10) {
6907
__Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
6908
}
6909
__Pyx_INCREF(__pyx_v_self->j);
6910
__Pyx_GIVEREF(__pyx_v_self->j);
6911
PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_v_self->j);
6912
__Pyx_INCREF(__pyx_v_self->c_quo);
6913
__Pyx_GIVEREF(__pyx_v_self->c_quo);
6914
PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_self->c_quo);
6915
__Pyx_GIVEREF(__pyx_t_9);
6916
PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_9);
6917
__pyx_t_9 = 0;
6918
__pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L7_error)
6919
__Pyx_GOTREF(__pyx_t_7);
6920
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6921
}
6922
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6923
__pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L7_error)
6924
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6925
(__pyx_v_self->ap[__pyx_v_i]) = __pyx_t_13;
6926
6927
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":285
6928
* p = self.primes[i]
6929
* if p >= 7:
6930
* try: # <<<<<<<<<<<<<<
6931
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
6932
* except Exception, msg:
6933
*/
6934
}
6935
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6936
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6937
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6938
goto __pyx_L14_try_end;
6939
__pyx_L7_error:;
6940
__Pyx_PyThreadState_assign
6941
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6942
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6943
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
6944
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6945
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
6946
6947
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":287
6948
* try:
6949
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
6950
* except Exception, msg: # <<<<<<<<<<<<<<
6951
* if get_verbose() > 0:
6952
* verbose("skipping inert table computation for p=%s (%s)"%(p, msg))
6953
*/
6954
__pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6955
if (__pyx_t_11) {
6956
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_inert_and_ramified_traces", __pyx_clineno, __pyx_lineno, __pyx_filename);
6957
if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_12) < 0) __PYX_ERR(0, 287, __pyx_L9_except_error)
6958
__Pyx_GOTREF(__pyx_t_7);
6959
__Pyx_GOTREF(__pyx_t_8);
6960
__Pyx_GOTREF(__pyx_t_12);
6961
__Pyx_INCREF(__pyx_t_8);
6962
__Pyx_XDECREF_SET(__pyx_v_msg, __pyx_t_8);
6963
6964
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":288
6965
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
6966
* except Exception, msg:
6967
* if get_verbose() > 0: # <<<<<<<<<<<<<<
6968
* verbose("skipping inert table computation for p=%s (%s)"%(p, msg))
6969
*
6970
*/
6971
__pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_verbose); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6972
__Pyx_GOTREF(__pyx_t_10);
6973
__pyx_t_14 = NULL;
6974
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
6975
__pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
6976
if (likely(__pyx_t_14)) {
6977
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
6978
__Pyx_INCREF(__pyx_t_14);
6979
__Pyx_INCREF(function);
6980
__Pyx_DECREF_SET(__pyx_t_10, function);
6981
}
6982
}
6983
if (__pyx_t_14) {
6984
__pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6985
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6986
} else {
6987
__pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6988
}
6989
__Pyx_GOTREF(__pyx_t_9);
6990
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6991
__pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6992
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6993
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 288, __pyx_L9_except_error)
6994
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6995
if (__pyx_t_3) {
6996
6997
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":289
6998
* except Exception, msg:
6999
* if get_verbose() > 0:
7000
* verbose("skipping inert table computation for p=%s (%s)"%(p, msg)) # <<<<<<<<<<<<<<
7001
*
7002
* def _compute_remaining_traces_naively(self):
7003
*/
7004
__pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_verbose); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7005
__Pyx_GOTREF(__pyx_t_9);
7006
__pyx_t_14 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7007
__Pyx_GOTREF(__pyx_t_14);
7008
__pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7009
__Pyx_GOTREF(__pyx_t_15);
7010
__Pyx_GIVEREF(__pyx_t_14);
7011
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
7012
__Pyx_INCREF(__pyx_v_msg);
7013
__Pyx_GIVEREF(__pyx_v_msg);
7014
PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_msg);
7015
__pyx_t_14 = 0;
7016
__pyx_t_14 = __Pyx_PyString_Format(__pyx_kp_s_skipping_inert_table_computation, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7017
__Pyx_GOTREF(__pyx_t_14);
7018
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7019
__pyx_t_15 = NULL;
7020
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
7021
__pyx_t_15 = PyMethod_GET_SELF(__pyx_t_9);
7022
if (likely(__pyx_t_15)) {
7023
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
7024
__Pyx_INCREF(__pyx_t_15);
7025
__Pyx_INCREF(function);
7026
__Pyx_DECREF_SET(__pyx_t_9, function);
7027
}
7028
}
7029
if (!__pyx_t_15) {
7030
__pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7031
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7032
__Pyx_GOTREF(__pyx_t_10);
7033
} else {
7034
#if CYTHON_FAST_PYCALL
7035
if (PyFunction_Check(__pyx_t_9)) {
7036
PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_14};
7037
__pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7038
__Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7039
__Pyx_GOTREF(__pyx_t_10);
7040
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7041
} else
7042
#endif
7043
#if CYTHON_FAST_PYCCALL
7044
if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
7045
PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_14};
7046
__pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7047
__Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7048
__Pyx_GOTREF(__pyx_t_10);
7049
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7050
} else
7051
#endif
7052
{
7053
__pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7054
__Pyx_GOTREF(__pyx_t_16);
7055
__Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
7056
__Pyx_GIVEREF(__pyx_t_14);
7057
PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_14);
7058
__pyx_t_14 = 0;
7059
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_16, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L9_except_error)
7060
__Pyx_GOTREF(__pyx_t_10);
7061
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7062
}
7063
}
7064
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
7065
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7066
7067
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":288
7068
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
7069
* except Exception, msg:
7070
* if get_verbose() > 0: # <<<<<<<<<<<<<<
7071
* verbose("skipping inert table computation for p=%s (%s)"%(p, msg))
7072
*
7073
*/
7074
}
7075
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7076
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7077
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7078
goto __pyx_L8_exception_handled;
7079
}
7080
goto __pyx_L9_except_error;
7081
__pyx_L9_except_error:;
7082
7083
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":285
7084
* p = self.primes[i]
7085
* if p >= 7:
7086
* try: # <<<<<<<<<<<<<<
7087
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
7088
* except Exception, msg:
7089
*/
7090
__Pyx_PyThreadState_assign
7091
__Pyx_XGIVEREF(__pyx_t_4);
7092
__Pyx_XGIVEREF(__pyx_t_5);
7093
__Pyx_XGIVEREF(__pyx_t_6);
7094
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
7095
goto __pyx_L1_error;
7096
__pyx_L8_exception_handled:;
7097
__Pyx_PyThreadState_assign
7098
__Pyx_XGIVEREF(__pyx_t_4);
7099
__Pyx_XGIVEREF(__pyx_t_5);
7100
__Pyx_XGIVEREF(__pyx_t_6);
7101
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
7102
__pyx_L14_try_end:;
7103
}
7104
7105
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":284
7106
* if self.sqrt5[i] == 0:
7107
* p = self.primes[i]
7108
* if p >= 7: # <<<<<<<<<<<<<<
7109
* try:
7110
* self.ap[i] = T.trace_of_frobenius(self.j, self.c_quo, p)
7111
*/
7112
}
7113
7114
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":282
7115
* cdef long i, p
7116
* for i in range(self.table_size):
7117
* if self.sqrt5[i] == 0: # <<<<<<<<<<<<<<
7118
* p = self.primes[i]
7119
* if p >= 7:
7120
*/
7121
}
7122
}
7123
7124
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":279
7125
* raise ValueError
7126
*
7127
* def _compute_inert_and_ramified_traces(self, T): # T = InertTraceCalculator # <<<<<<<<<<<<<<
7128
* cdef long i, p
7129
* for i in range(self.table_size):
7130
*/
7131
7132
/* function exit code */
7133
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
7134
goto __pyx_L0;
7135
__pyx_L1_error:;
7136
__Pyx_XDECREF(__pyx_t_7);
7137
__Pyx_XDECREF(__pyx_t_8);
7138
__Pyx_XDECREF(__pyx_t_9);
7139
__Pyx_XDECREF(__pyx_t_10);
7140
__Pyx_XDECREF(__pyx_t_12);
7141
__Pyx_XDECREF(__pyx_t_14);
7142
__Pyx_XDECREF(__pyx_t_15);
7143
__Pyx_XDECREF(__pyx_t_16);
7144
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_inert_and_ramified_traces", __pyx_clineno, __pyx_lineno, __pyx_filename);
7145
__pyx_r = NULL;
7146
__pyx_L0:;
7147
__Pyx_XDECREF(__pyx_v_msg);
7148
__Pyx_XGIVEREF(__pyx_r);
7149
__Pyx_RefNannyFinishContext();
7150
return __pyx_r;
7151
}
7152
7153
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":291
7154
* verbose("skipping inert table computation for p=%s (%s)"%(p, msg))
7155
*
7156
* def _compute_remaining_traces_naively(self): # <<<<<<<<<<<<<<
7157
* """
7158
* Compute any traces not already computed using naive algorithm.
7159
*/
7160
7161
/* Python wrapper */
7162
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_19_compute_remaining_traces_naively(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
7163
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_18_compute_remaining_traces_naively[] = "File: sqrt5.pyx (starting at line 291)\n\n Compute any traces not already computed using naive algorithm.\n ";
7164
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_19_compute_remaining_traces_naively(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7165
PyObject *__pyx_r = 0;
7166
__Pyx_RefNannyDeclarations
7167
__Pyx_RefNannySetupContext("_compute_remaining_traces_naively (wrapper)", 0);
7168
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_18_compute_remaining_traces_naively(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self));
7169
7170
/* function exit code */
7171
__Pyx_RefNannyFinishContext();
7172
return __pyx_r;
7173
}
7174
7175
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_18_compute_remaining_traces_naively(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self) {
7176
long __pyx_v_i;
7177
PyObject *__pyx_r = NULL;
7178
__Pyx_RefNannyDeclarations
7179
long __pyx_t_1;
7180
long __pyx_t_2;
7181
int __pyx_t_3;
7182
PyObject *__pyx_t_4 = NULL;
7183
PyObject *__pyx_t_5 = NULL;
7184
PyObject *__pyx_t_6 = NULL;
7185
PyObject *__pyx_t_7 = NULL;
7186
PyObject *__pyx_t_8 = NULL;
7187
__Pyx_RefNannySetupContext("_compute_remaining_traces_naively", 0);
7188
7189
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":296
7190
* """
7191
* cdef long i
7192
* for i in range(self.table_size): # <<<<<<<<<<<<<<
7193
* if self.ap[i] == UNKNOWN:
7194
* self._compute_naive_trace(i)
7195
*/
7196
__pyx_t_1 = __pyx_v_self->table_size;
7197
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
7198
__pyx_v_i = __pyx_t_2;
7199
7200
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":297
7201
* cdef long i
7202
* for i in range(self.table_size):
7203
* if self.ap[i] == UNKNOWN: # <<<<<<<<<<<<<<
7204
* self._compute_naive_trace(i)
7205
*
7206
*/
7207
__pyx_t_3 = (((__pyx_v_self->ap[__pyx_v_i]) == __pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN) != 0);
7208
if (__pyx_t_3) {
7209
7210
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":298
7211
* for i in range(self.table_size):
7212
* if self.ap[i] == UNKNOWN:
7213
* self._compute_naive_trace(i) # <<<<<<<<<<<<<<
7214
*
7215
* def _compute_naive_trace(self, i):
7216
*/
7217
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compute_naive_trace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 298, __pyx_L1_error)
7218
__Pyx_GOTREF(__pyx_t_5);
7219
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
7220
__Pyx_GOTREF(__pyx_t_6);
7221
__pyx_t_7 = NULL;
7222
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7223
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
7224
if (likely(__pyx_t_7)) {
7225
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7226
__Pyx_INCREF(__pyx_t_7);
7227
__Pyx_INCREF(function);
7228
__Pyx_DECREF_SET(__pyx_t_5, function);
7229
}
7230
}
7231
if (!__pyx_t_7) {
7232
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
7233
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7234
__Pyx_GOTREF(__pyx_t_4);
7235
} else {
7236
#if CYTHON_FAST_PYCALL
7237
if (PyFunction_Check(__pyx_t_5)) {
7238
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
7239
__pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
7240
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7241
__Pyx_GOTREF(__pyx_t_4);
7242
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7243
} else
7244
#endif
7245
#if CYTHON_FAST_PYCCALL
7246
if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7247
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
7248
__pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
7249
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
7250
__Pyx_GOTREF(__pyx_t_4);
7251
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7252
} else
7253
#endif
7254
{
7255
__pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 298, __pyx_L1_error)
7256
__Pyx_GOTREF(__pyx_t_8);
7257
__Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
7258
__Pyx_GIVEREF(__pyx_t_6);
7259
PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
7260
__pyx_t_6 = 0;
7261
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
7262
__Pyx_GOTREF(__pyx_t_4);
7263
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7264
}
7265
}
7266
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7267
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7268
7269
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":297
7270
* cdef long i
7271
* for i in range(self.table_size):
7272
* if self.ap[i] == UNKNOWN: # <<<<<<<<<<<<<<
7273
* self._compute_naive_trace(i)
7274
*
7275
*/
7276
}
7277
}
7278
7279
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":291
7280
* verbose("skipping inert table computation for p=%s (%s)"%(p, msg))
7281
*
7282
* def _compute_remaining_traces_naively(self): # <<<<<<<<<<<<<<
7283
* """
7284
* Compute any traces not already computed using naive algorithm.
7285
*/
7286
7287
/* function exit code */
7288
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
7289
goto __pyx_L0;
7290
__pyx_L1_error:;
7291
__Pyx_XDECREF(__pyx_t_4);
7292
__Pyx_XDECREF(__pyx_t_5);
7293
__Pyx_XDECREF(__pyx_t_6);
7294
__Pyx_XDECREF(__pyx_t_7);
7295
__Pyx_XDECREF(__pyx_t_8);
7296
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_remaining_traces_naively", __pyx_clineno, __pyx_lineno, __pyx_filename);
7297
__pyx_r = NULL;
7298
__pyx_L0:;
7299
__Pyx_XGIVEREF(__pyx_r);
7300
__Pyx_RefNannyFinishContext();
7301
return __pyx_r;
7302
}
7303
7304
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":300
7305
* self._compute_naive_trace(i)
7306
*
7307
* def _compute_naive_trace(self, i): # <<<<<<<<<<<<<<
7308
* """
7309
* Compute trace at position i using naive algorithm.
7310
*/
7311
7312
/* Python wrapper */
7313
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_21_compute_naive_trace(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
7314
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_20_compute_naive_trace[] = "File: sqrt5.pyx (starting at line 300)\n\n Compute trace at position i using naive algorithm.\n ";
7315
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_21_compute_naive_trace(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
7316
PyObject *__pyx_r = 0;
7317
__Pyx_RefNannyDeclarations
7318
__Pyx_RefNannySetupContext("_compute_naive_trace (wrapper)", 0);
7319
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_20_compute_naive_trace(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), ((PyObject *)__pyx_v_i));
7320
7321
/* function exit code */
7322
__Pyx_RefNannyFinishContext();
7323
return __pyx_r;
7324
}
7325
7326
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_20_compute_naive_trace(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_i) {
7327
PyObject *__pyx_r = NULL;
7328
__Pyx_RefNannyDeclarations
7329
PyObject *__pyx_t_1 = NULL;
7330
PyObject *__pyx_t_2 = NULL;
7331
PyObject *__pyx_t_3 = NULL;
7332
int __pyx_t_4;
7333
Py_ssize_t __pyx_t_5;
7334
PyObject *__pyx_t_6 = NULL;
7335
PyObject *__pyx_t_7 = NULL;
7336
PyObject *__pyx_t_8 = NULL;
7337
int __pyx_t_9;
7338
long __pyx_t_10;
7339
__Pyx_RefNannySetupContext("_compute_naive_trace", 0);
7340
7341
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":304
7342
* Compute trace at position i using naive algorithm.
7343
* """
7344
* if get_verbose() > 0: # since forming verbose error message is expensive # <<<<<<<<<<<<<<
7345
* verbose("naive i=%s, a_{%s}"%(i,self.primes[i]))
7346
* self.ap[i] = aplist.ap(self.E, self.prime(i))
7347
*/
7348
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_verbose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
7349
__Pyx_GOTREF(__pyx_t_2);
7350
__pyx_t_3 = NULL;
7351
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7352
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7353
if (likely(__pyx_t_3)) {
7354
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7355
__Pyx_INCREF(__pyx_t_3);
7356
__Pyx_INCREF(function);
7357
__Pyx_DECREF_SET(__pyx_t_2, function);
7358
}
7359
}
7360
if (__pyx_t_3) {
7361
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
7362
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7363
} else {
7364
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
7365
}
7366
__Pyx_GOTREF(__pyx_t_1);
7367
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7368
__pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
7369
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7370
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
7371
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7372
if (__pyx_t_4) {
7373
7374
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":305
7375
* """
7376
* if get_verbose() > 0: # since forming verbose error message is expensive
7377
* verbose("naive i=%s, a_{%s}"%(i,self.primes[i])) # <<<<<<<<<<<<<<
7378
* self.ap[i] = aplist.ap(self.E, self.prime(i))
7379
*
7380
*/
7381
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_verbose); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
7382
__Pyx_GOTREF(__pyx_t_1);
7383
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L1_error)
7384
__pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_self->primes[__pyx_t_5])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
7385
__Pyx_GOTREF(__pyx_t_3);
7386
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 305, __pyx_L1_error)
7387
__Pyx_GOTREF(__pyx_t_6);
7388
__Pyx_INCREF(__pyx_v_i);
7389
__Pyx_GIVEREF(__pyx_v_i);
7390
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_i);
7391
__Pyx_GIVEREF(__pyx_t_3);
7392
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
7393
__pyx_t_3 = 0;
7394
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_naive_i_s_a__s, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
7395
__Pyx_GOTREF(__pyx_t_3);
7396
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7397
__pyx_t_6 = NULL;
7398
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
7399
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
7400
if (likely(__pyx_t_6)) {
7401
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
7402
__Pyx_INCREF(__pyx_t_6);
7403
__Pyx_INCREF(function);
7404
__Pyx_DECREF_SET(__pyx_t_1, function);
7405
}
7406
}
7407
if (!__pyx_t_6) {
7408
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
7409
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7410
__Pyx_GOTREF(__pyx_t_2);
7411
} else {
7412
#if CYTHON_FAST_PYCALL
7413
if (PyFunction_Check(__pyx_t_1)) {
7414
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
7415
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
7416
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7417
__Pyx_GOTREF(__pyx_t_2);
7418
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7419
} else
7420
#endif
7421
#if CYTHON_FAST_PYCCALL
7422
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
7423
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
7424
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
7425
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7426
__Pyx_GOTREF(__pyx_t_2);
7427
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7428
} else
7429
#endif
7430
{
7431
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 305, __pyx_L1_error)
7432
__Pyx_GOTREF(__pyx_t_7);
7433
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
7434
__Pyx_GIVEREF(__pyx_t_3);
7435
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_3);
7436
__pyx_t_3 = 0;
7437
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error)
7438
__Pyx_GOTREF(__pyx_t_2);
7439
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7440
}
7441
}
7442
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7443
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7444
7445
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":304
7446
* Compute trace at position i using naive algorithm.
7447
* """
7448
* if get_verbose() > 0: # since forming verbose error message is expensive # <<<<<<<<<<<<<<
7449
* verbose("naive i=%s, a_{%s}"%(i,self.primes[i]))
7450
* self.ap[i] = aplist.ap(self.E, self.prime(i))
7451
*/
7452
}
7453
7454
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":306
7455
* if get_verbose() > 0: # since forming verbose error message is expensive
7456
* verbose("naive i=%s, a_{%s}"%(i,self.primes[i]))
7457
* self.ap[i] = aplist.ap(self.E, self.prime(i)) # <<<<<<<<<<<<<<
7458
*
7459
* def prime(self, long i):
7460
*/
7461
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_aplist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
7462
__Pyx_GOTREF(__pyx_t_1);
7463
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ap); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 306, __pyx_L1_error)
7464
__Pyx_GOTREF(__pyx_t_7);
7465
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7466
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
7467
__Pyx_GOTREF(__pyx_t_3);
7468
__pyx_t_6 = NULL;
7469
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7470
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
7471
if (likely(__pyx_t_6)) {
7472
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7473
__Pyx_INCREF(__pyx_t_6);
7474
__Pyx_INCREF(function);
7475
__Pyx_DECREF_SET(__pyx_t_3, function);
7476
}
7477
}
7478
if (!__pyx_t_6) {
7479
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
7480
__Pyx_GOTREF(__pyx_t_1);
7481
} else {
7482
#if CYTHON_FAST_PYCALL
7483
if (PyFunction_Check(__pyx_t_3)) {
7484
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_i};
7485
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
7486
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7487
__Pyx_GOTREF(__pyx_t_1);
7488
} else
7489
#endif
7490
#if CYTHON_FAST_PYCCALL
7491
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7492
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_i};
7493
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
7494
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7495
__Pyx_GOTREF(__pyx_t_1);
7496
} else
7497
#endif
7498
{
7499
__pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
7500
__Pyx_GOTREF(__pyx_t_8);
7501
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
7502
__Pyx_INCREF(__pyx_v_i);
7503
__Pyx_GIVEREF(__pyx_v_i);
7504
PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_i);
7505
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
7506
__Pyx_GOTREF(__pyx_t_1);
7507
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7508
}
7509
}
7510
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7511
__pyx_t_3 = NULL;
7512
__pyx_t_9 = 0;
7513
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
7514
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
7515
if (likely(__pyx_t_3)) {
7516
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
7517
__Pyx_INCREF(__pyx_t_3);
7518
__Pyx_INCREF(function);
7519
__Pyx_DECREF_SET(__pyx_t_7, function);
7520
__pyx_t_9 = 1;
7521
}
7522
}
7523
#if CYTHON_FAST_PYCALL
7524
if (PyFunction_Check(__pyx_t_7)) {
7525
PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->E, __pyx_t_1};
7526
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
7527
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7528
__Pyx_GOTREF(__pyx_t_2);
7529
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7530
} else
7531
#endif
7532
#if CYTHON_FAST_PYCCALL
7533
if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
7534
PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->E, __pyx_t_1};
7535
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
7536
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7537
__Pyx_GOTREF(__pyx_t_2);
7538
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7539
} else
7540
#endif
7541
{
7542
__pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
7543
__Pyx_GOTREF(__pyx_t_8);
7544
if (__pyx_t_3) {
7545
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
7546
}
7547
__Pyx_INCREF(__pyx_v_self->E);
7548
__Pyx_GIVEREF(__pyx_v_self->E);
7549
PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_v_self->E);
7550
__Pyx_GIVEREF(__pyx_t_1);
7551
PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_1);
7552
__pyx_t_1 = 0;
7553
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error)
7554
__Pyx_GOTREF(__pyx_t_2);
7555
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7556
}
7557
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7558
__pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error)
7559
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7560
__pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error)
7561
(__pyx_v_self->ap[__pyx_t_5]) = __pyx_t_10;
7562
7563
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":300
7564
* self._compute_naive_trace(i)
7565
*
7566
* def _compute_naive_trace(self, i): # <<<<<<<<<<<<<<
7567
* """
7568
* Compute trace at position i using naive algorithm.
7569
*/
7570
7571
/* function exit code */
7572
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
7573
goto __pyx_L0;
7574
__pyx_L1_error:;
7575
__Pyx_XDECREF(__pyx_t_1);
7576
__Pyx_XDECREF(__pyx_t_2);
7577
__Pyx_XDECREF(__pyx_t_3);
7578
__Pyx_XDECREF(__pyx_t_6);
7579
__Pyx_XDECREF(__pyx_t_7);
7580
__Pyx_XDECREF(__pyx_t_8);
7581
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_naive_trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
7582
__pyx_r = NULL;
7583
__pyx_L0:;
7584
__Pyx_XGIVEREF(__pyx_r);
7585
__Pyx_RefNannyFinishContext();
7586
return __pyx_r;
7587
}
7588
7589
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":308
7590
* self.ap[i] = aplist.ap(self.E, self.prime(i))
7591
*
7592
* def prime(self, long i): # <<<<<<<<<<<<<<
7593
* """
7594
* Return the i-th prime as a fractional ideal of Q(sqrt(5)).
7595
*/
7596
7597
/* Python wrapper */
7598
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_23prime(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
7599
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_22prime[] = "File: sqrt5.pyx (starting at line 308)\n\n Return the i-th prime as a fractional ideal of Q(sqrt(5)).\n\n INPUT:\n i -- positive integer\n ";
7600
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_23prime(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
7601
long __pyx_v_i;
7602
PyObject *__pyx_r = 0;
7603
__Pyx_RefNannyDeclarations
7604
__Pyx_RefNannySetupContext("prime (wrapper)", 0);
7605
assert(__pyx_arg_i); {
7606
__pyx_v_i = __Pyx_PyInt_As_long(__pyx_arg_i); if (unlikely((__pyx_v_i == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
7607
}
7608
goto __pyx_L4_argument_unpacking_done;
7609
__pyx_L3_error:;
7610
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius.prime", __pyx_clineno, __pyx_lineno, __pyx_filename);
7611
__Pyx_RefNannyFinishContext();
7612
return NULL;
7613
__pyx_L4_argument_unpacking_done:;
7614
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_22prime(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), ((long)__pyx_v_i));
7615
7616
/* function exit code */
7617
__Pyx_RefNannyFinishContext();
7618
return __pyx_r;
7619
}
7620
7621
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_22prime(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, long __pyx_v_i) {
7622
PyObject *__pyx_v_F = NULL;
7623
long __pyx_v_a;
7624
long __pyx_v_p;
7625
long __pyx_v_s;
7626
PyObject *__pyx_r = NULL;
7627
__Pyx_RefNannyDeclarations
7628
int __pyx_t_1;
7629
int __pyx_t_2;
7630
PyObject *__pyx_t_3 = NULL;
7631
PyObject *__pyx_t_4 = NULL;
7632
PyObject *__pyx_t_5 = NULL;
7633
PyObject *__pyx_t_6 = NULL;
7634
PyObject *__pyx_t_7 = NULL;
7635
PyObject *__pyx_t_8 = NULL;
7636
__Pyx_RefNannySetupContext("prime", 0);
7637
7638
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":315
7639
* i -- positive integer
7640
* """
7641
* if i < 0 or i >= self.table_size: # <<<<<<<<<<<<<<
7642
* raise IndexError, "i must be between 0 and %s"%(self.table_size-1)
7643
*
7644
*/
7645
__pyx_t_2 = ((__pyx_v_i < 0) != 0);
7646
if (!__pyx_t_2) {
7647
} else {
7648
__pyx_t_1 = __pyx_t_2;
7649
goto __pyx_L4_bool_binop_done;
7650
}
7651
__pyx_t_2 = ((__pyx_v_i >= __pyx_v_self->table_size) != 0);
7652
__pyx_t_1 = __pyx_t_2;
7653
__pyx_L4_bool_binop_done:;
7654
if (__pyx_t_1) {
7655
7656
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":316
7657
* """
7658
* if i < 0 or i >= self.table_size:
7659
* raise IndexError, "i must be between 0 and %s"%(self.table_size-1) # <<<<<<<<<<<<<<
7660
*
7661
* # Non-optimized code that returns the ith prime of the quadratic number field.
7662
*/
7663
__pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_self->table_size - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
7664
__Pyx_GOTREF(__pyx_t_3);
7665
__pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_i_must_be_between_0_and_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 316, __pyx_L1_error)
7666
__Pyx_GOTREF(__pyx_t_4);
7667
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7668
__Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_4, 0, 0);
7669
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7670
__PYX_ERR(0, 316, __pyx_L1_error)
7671
7672
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":315
7673
* i -- positive integer
7674
* """
7675
* if i < 0 or i >= self.table_size: # <<<<<<<<<<<<<<
7676
* raise IndexError, "i must be between 0 and %s"%(self.table_size-1)
7677
*
7678
*/
7679
}
7680
7681
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":319
7682
*
7683
* # Non-optimized code that returns the ith prime of the quadratic number field.
7684
* from psage.modform.hilbert.sqrt5.sqrt5 import F # F = Q(sqrt(5)) # <<<<<<<<<<<<<<
7685
* cdef long a, p = self.primes[i], s = self.sqrt5[i]
7686
* if p == 5: # ramified
7687
*/
7688
__pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
7689
__Pyx_GOTREF(__pyx_t_4);
7690
__Pyx_INCREF(__pyx_n_s_F);
7691
__Pyx_GIVEREF(__pyx_n_s_F);
7692
PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_F);
7693
__pyx_t_3 = __Pyx_Import(__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt, __pyx_t_4, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
7694
__Pyx_GOTREF(__pyx_t_3);
7695
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7696
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_F); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
7697
__Pyx_GOTREF(__pyx_t_4);
7698
__Pyx_INCREF(__pyx_t_4);
7699
__pyx_v_F = __pyx_t_4;
7700
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7701
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7702
7703
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":320
7704
* # Non-optimized code that returns the ith prime of the quadratic number field.
7705
* from psage.modform.hilbert.sqrt5.sqrt5 import F # F = Q(sqrt(5))
7706
* cdef long a, p = self.primes[i], s = self.sqrt5[i] # <<<<<<<<<<<<<<
7707
* if p == 5: # ramified
7708
* return F.ideal(2*F.gen() - 1)
7709
*/
7710
__pyx_v_p = (__pyx_v_self->primes[__pyx_v_i]);
7711
__pyx_v_s = (__pyx_v_self->sqrt5[__pyx_v_i]);
7712
7713
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":321
7714
* from psage.modform.hilbert.sqrt5.sqrt5 import F # F = Q(sqrt(5))
7715
* cdef long a, p = self.primes[i], s = self.sqrt5[i]
7716
* if p == 5: # ramified # <<<<<<<<<<<<<<
7717
* return F.ideal(2*F.gen() - 1)
7718
*
7719
*/
7720
__pyx_t_1 = ((__pyx_v_p == 5) != 0);
7721
if (__pyx_t_1) {
7722
7723
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":322
7724
* cdef long a, p = self.primes[i], s = self.sqrt5[i]
7725
* if p == 5: # ramified
7726
* return F.ideal(2*F.gen() - 1) # <<<<<<<<<<<<<<
7727
*
7728
* a = p % 5
7729
*/
7730
__Pyx_XDECREF(__pyx_r);
7731
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_ideal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 322, __pyx_L1_error)
7732
__Pyx_GOTREF(__pyx_t_4);
7733
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_gen); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error)
7734
__Pyx_GOTREF(__pyx_t_6);
7735
__pyx_t_7 = NULL;
7736
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
7737
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
7738
if (likely(__pyx_t_7)) {
7739
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
7740
__Pyx_INCREF(__pyx_t_7);
7741
__Pyx_INCREF(function);
7742
__Pyx_DECREF_SET(__pyx_t_6, function);
7743
}
7744
}
7745
if (__pyx_t_7) {
7746
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
7747
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7748
} else {
7749
__pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
7750
}
7751
__Pyx_GOTREF(__pyx_t_5);
7752
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7753
__pyx_t_6 = PyNumber_Multiply(__pyx_int_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error)
7754
__Pyx_GOTREF(__pyx_t_6);
7755
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7756
__pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_t_6, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
7757
__Pyx_GOTREF(__pyx_t_5);
7758
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7759
__pyx_t_6 = NULL;
7760
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7761
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
7762
if (likely(__pyx_t_6)) {
7763
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7764
__Pyx_INCREF(__pyx_t_6);
7765
__Pyx_INCREF(function);
7766
__Pyx_DECREF_SET(__pyx_t_4, function);
7767
}
7768
}
7769
if (!__pyx_t_6) {
7770
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
7771
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7772
__Pyx_GOTREF(__pyx_t_3);
7773
} else {
7774
#if CYTHON_FAST_PYCALL
7775
if (PyFunction_Check(__pyx_t_4)) {
7776
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
7777
__pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
7778
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7779
__Pyx_GOTREF(__pyx_t_3);
7780
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7781
} else
7782
#endif
7783
#if CYTHON_FAST_PYCCALL
7784
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
7785
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
7786
__pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
7787
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7788
__Pyx_GOTREF(__pyx_t_3);
7789
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7790
} else
7791
#endif
7792
{
7793
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
7794
__Pyx_GOTREF(__pyx_t_7);
7795
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
7796
__Pyx_GIVEREF(__pyx_t_5);
7797
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
7798
__pyx_t_5 = 0;
7799
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
7800
__Pyx_GOTREF(__pyx_t_3);
7801
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7802
}
7803
}
7804
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7805
__pyx_r = __pyx_t_3;
7806
__pyx_t_3 = 0;
7807
goto __pyx_L0;
7808
7809
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":321
7810
* from psage.modform.hilbert.sqrt5.sqrt5 import F # F = Q(sqrt(5))
7811
* cdef long a, p = self.primes[i], s = self.sqrt5[i]
7812
* if p == 5: # ramified # <<<<<<<<<<<<<<
7813
* return F.ideal(2*F.gen() - 1)
7814
*
7815
*/
7816
}
7817
7818
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":324
7819
* return F.ideal(2*F.gen() - 1)
7820
*
7821
* a = p % 5 # <<<<<<<<<<<<<<
7822
* if a==2 or a==3: # inert
7823
* return F.ideal(p)
7824
*/
7825
__pyx_v_a = __Pyx_mod_long(__pyx_v_p, 5);
7826
7827
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":325
7828
*
7829
* a = p % 5
7830
* if a==2 or a==3: # inert # <<<<<<<<<<<<<<
7831
* return F.ideal(p)
7832
* else: # split case
7833
*/
7834
switch (__pyx_v_a) {
7835
case 2:
7836
case 3:
7837
7838
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":326
7839
* a = p % 5
7840
* if a==2 or a==3: # inert
7841
* return F.ideal(p) # <<<<<<<<<<<<<<
7842
* else: # split case
7843
* return F.ideal([p, 2*F.gen()-1 - s])
7844
*/
7845
__Pyx_XDECREF(__pyx_r);
7846
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_ideal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
7847
__Pyx_GOTREF(__pyx_t_4);
7848
__pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 326, __pyx_L1_error)
7849
__Pyx_GOTREF(__pyx_t_7);
7850
__pyx_t_5 = NULL;
7851
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7852
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
7853
if (likely(__pyx_t_5)) {
7854
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7855
__Pyx_INCREF(__pyx_t_5);
7856
__Pyx_INCREF(function);
7857
__Pyx_DECREF_SET(__pyx_t_4, function);
7858
}
7859
}
7860
if (!__pyx_t_5) {
7861
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
7862
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7863
__Pyx_GOTREF(__pyx_t_3);
7864
} else {
7865
#if CYTHON_FAST_PYCALL
7866
if (PyFunction_Check(__pyx_t_4)) {
7867
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
7868
__pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
7869
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7870
__Pyx_GOTREF(__pyx_t_3);
7871
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7872
} else
7873
#endif
7874
#if CYTHON_FAST_PYCCALL
7875
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
7876
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_7};
7877
__pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
7878
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
7879
__Pyx_GOTREF(__pyx_t_3);
7880
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7881
} else
7882
#endif
7883
{
7884
__pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 326, __pyx_L1_error)
7885
__Pyx_GOTREF(__pyx_t_6);
7886
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
7887
__Pyx_GIVEREF(__pyx_t_7);
7888
PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_7);
7889
__pyx_t_7 = 0;
7890
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
7891
__Pyx_GOTREF(__pyx_t_3);
7892
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7893
}
7894
}
7895
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7896
__pyx_r = __pyx_t_3;
7897
__pyx_t_3 = 0;
7898
goto __pyx_L0;
7899
7900
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":325
7901
*
7902
* a = p % 5
7903
* if a==2 or a==3: # inert # <<<<<<<<<<<<<<
7904
* return F.ideal(p)
7905
* else: # split case
7906
*/
7907
break;
7908
default:
7909
7910
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":328
7911
* return F.ideal(p)
7912
* else: # split case
7913
* return F.ideal([p, 2*F.gen()-1 - s]) # <<<<<<<<<<<<<<
7914
*
7915
* def _compute_traces(self, inert_table, algorithm='smalljac'):
7916
*/
7917
__Pyx_XDECREF(__pyx_r);
7918
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_ideal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
7919
__Pyx_GOTREF(__pyx_t_4);
7920
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
7921
__Pyx_GOTREF(__pyx_t_6);
7922
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_gen); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
7923
__Pyx_GOTREF(__pyx_t_5);
7924
__pyx_t_8 = NULL;
7925
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7926
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
7927
if (likely(__pyx_t_8)) {
7928
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7929
__Pyx_INCREF(__pyx_t_8);
7930
__Pyx_INCREF(function);
7931
__Pyx_DECREF_SET(__pyx_t_5, function);
7932
}
7933
}
7934
if (__pyx_t_8) {
7935
__pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error)
7936
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7937
} else {
7938
__pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error)
7939
}
7940
__Pyx_GOTREF(__pyx_t_7);
7941
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7942
__pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
7943
__Pyx_GOTREF(__pyx_t_5);
7944
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7945
__pyx_t_7 = __Pyx_PyInt_SubtractObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error)
7946
__Pyx_GOTREF(__pyx_t_7);
7947
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7948
__pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_s); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
7949
__Pyx_GOTREF(__pyx_t_5);
7950
__pyx_t_8 = PyNumber_Subtract(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 328, __pyx_L1_error)
7951
__Pyx_GOTREF(__pyx_t_8);
7952
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7953
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7954
__pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
7955
__Pyx_GOTREF(__pyx_t_5);
7956
__Pyx_GIVEREF(__pyx_t_6);
7957
PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
7958
__Pyx_GIVEREF(__pyx_t_8);
7959
PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
7960
__pyx_t_6 = 0;
7961
__pyx_t_8 = 0;
7962
__pyx_t_8 = NULL;
7963
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
7964
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
7965
if (likely(__pyx_t_8)) {
7966
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7967
__Pyx_INCREF(__pyx_t_8);
7968
__Pyx_INCREF(function);
7969
__Pyx_DECREF_SET(__pyx_t_4, function);
7970
}
7971
}
7972
if (!__pyx_t_8) {
7973
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
7974
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7975
__Pyx_GOTREF(__pyx_t_3);
7976
} else {
7977
#if CYTHON_FAST_PYCALL
7978
if (PyFunction_Check(__pyx_t_4)) {
7979
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5};
7980
__pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
7981
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7982
__Pyx_GOTREF(__pyx_t_3);
7983
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7984
} else
7985
#endif
7986
#if CYTHON_FAST_PYCCALL
7987
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
7988
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5};
7989
__pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
7990
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7991
__Pyx_GOTREF(__pyx_t_3);
7992
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7993
} else
7994
#endif
7995
{
7996
__pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
7997
__Pyx_GOTREF(__pyx_t_6);
7998
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
7999
__Pyx_GIVEREF(__pyx_t_5);
8000
PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
8001
__pyx_t_5 = 0;
8002
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
8003
__Pyx_GOTREF(__pyx_t_3);
8004
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8005
}
8006
}
8007
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8008
__pyx_r = __pyx_t_3;
8009
__pyx_t_3 = 0;
8010
goto __pyx_L0;
8011
break;
8012
}
8013
8014
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":308
8015
* self.ap[i] = aplist.ap(self.E, self.prime(i))
8016
*
8017
* def prime(self, long i): # <<<<<<<<<<<<<<
8018
* """
8019
* Return the i-th prime as a fractional ideal of Q(sqrt(5)).
8020
*/
8021
8022
/* function exit code */
8023
__pyx_L1_error:;
8024
__Pyx_XDECREF(__pyx_t_3);
8025
__Pyx_XDECREF(__pyx_t_4);
8026
__Pyx_XDECREF(__pyx_t_5);
8027
__Pyx_XDECREF(__pyx_t_6);
8028
__Pyx_XDECREF(__pyx_t_7);
8029
__Pyx_XDECREF(__pyx_t_8);
8030
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius.prime", __pyx_clineno, __pyx_lineno, __pyx_filename);
8031
__pyx_r = NULL;
8032
__pyx_L0:;
8033
__Pyx_XDECREF(__pyx_v_F);
8034
__Pyx_XGIVEREF(__pyx_r);
8035
__Pyx_RefNannyFinishContext();
8036
return __pyx_r;
8037
}
8038
8039
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":330
8040
* return F.ideal([p, 2*F.gen()-1 - s])
8041
*
8042
* def _compute_traces(self, inert_table, algorithm='smalljac'): # <<<<<<<<<<<<<<
8043
* self._compute_split_traces()
8044
* self._compute_inert_and_ramified_traces(inert_table)
8045
*/
8046
8047
/* Python wrapper */
8048
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_25_compute_traces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8049
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_24_compute_traces[] = "File: sqrt5.pyx (starting at line 330)";
8050
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_25_compute_traces(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8051
PyObject *__pyx_v_inert_table = 0;
8052
CYTHON_UNUSED PyObject *__pyx_v_algorithm = 0;
8053
PyObject *__pyx_r = 0;
8054
__Pyx_RefNannyDeclarations
8055
__Pyx_RefNannySetupContext("_compute_traces (wrapper)", 0);
8056
{
8057
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inert_table,&__pyx_n_s_algorithm,0};
8058
PyObject* values[2] = {0,0};
8059
values[1] = ((PyObject *)__pyx_n_s_smalljac);
8060
if (unlikely(__pyx_kwds)) {
8061
Py_ssize_t kw_args;
8062
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8063
switch (pos_args) {
8064
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8065
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8066
case 0: break;
8067
default: goto __pyx_L5_argtuple_error;
8068
}
8069
kw_args = PyDict_Size(__pyx_kwds);
8070
switch (pos_args) {
8071
case 0:
8072
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_inert_table)) != 0)) kw_args--;
8073
else goto __pyx_L5_argtuple_error;
8074
case 1:
8075
if (kw_args > 0) {
8076
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_algorithm);
8077
if (value) { values[1] = value; kw_args--; }
8078
}
8079
}
8080
if (unlikely(kw_args > 0)) {
8081
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_compute_traces") < 0)) __PYX_ERR(0, 330, __pyx_L3_error)
8082
}
8083
} else {
8084
switch (PyTuple_GET_SIZE(__pyx_args)) {
8085
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8086
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8087
break;
8088
default: goto __pyx_L5_argtuple_error;
8089
}
8090
}
8091
__pyx_v_inert_table = values[0];
8092
__pyx_v_algorithm = values[1];
8093
}
8094
goto __pyx_L4_argument_unpacking_done;
8095
__pyx_L5_argtuple_error:;
8096
__Pyx_RaiseArgtupleInvalid("_compute_traces", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 330, __pyx_L3_error)
8097
__pyx_L3_error:;
8098
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_traces", __pyx_clineno, __pyx_lineno, __pyx_filename);
8099
__Pyx_RefNannyFinishContext();
8100
return NULL;
8101
__pyx_L4_argument_unpacking_done:;
8102
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_24_compute_traces(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)__pyx_v_self), __pyx_v_inert_table, __pyx_v_algorithm);
8103
8104
/* function exit code */
8105
__Pyx_RefNannyFinishContext();
8106
return __pyx_r;
8107
}
8108
8109
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_24_compute_traces(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *__pyx_v_self, PyObject *__pyx_v_inert_table, CYTHON_UNUSED PyObject *__pyx_v_algorithm) {
8110
PyObject *__pyx_r = NULL;
8111
__Pyx_RefNannyDeclarations
8112
PyObject *__pyx_t_1 = NULL;
8113
PyObject *__pyx_t_2 = NULL;
8114
PyObject *__pyx_t_3 = NULL;
8115
PyObject *__pyx_t_4 = NULL;
8116
__Pyx_RefNannySetupContext("_compute_traces", 0);
8117
8118
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":331
8119
*
8120
* def _compute_traces(self, inert_table, algorithm='smalljac'):
8121
* self._compute_split_traces() # <<<<<<<<<<<<<<
8122
* self._compute_inert_and_ramified_traces(inert_table)
8123
* self._compute_remaining_traces_naively()
8124
*/
8125
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compute_split_traces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
8126
__Pyx_GOTREF(__pyx_t_2);
8127
__pyx_t_3 = NULL;
8128
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8129
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8130
if (likely(__pyx_t_3)) {
8131
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8132
__Pyx_INCREF(__pyx_t_3);
8133
__Pyx_INCREF(function);
8134
__Pyx_DECREF_SET(__pyx_t_2, function);
8135
}
8136
}
8137
if (__pyx_t_3) {
8138
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
8139
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8140
} else {
8141
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
8142
}
8143
__Pyx_GOTREF(__pyx_t_1);
8144
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8145
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8146
8147
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":332
8148
* def _compute_traces(self, inert_table, algorithm='smalljac'):
8149
* self._compute_split_traces()
8150
* self._compute_inert_and_ramified_traces(inert_table) # <<<<<<<<<<<<<<
8151
* self._compute_remaining_traces_naively()
8152
*
8153
*/
8154
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compute_inert_and_ramified_trac); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
8155
__Pyx_GOTREF(__pyx_t_2);
8156
__pyx_t_3 = NULL;
8157
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8158
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8159
if (likely(__pyx_t_3)) {
8160
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8161
__Pyx_INCREF(__pyx_t_3);
8162
__Pyx_INCREF(function);
8163
__Pyx_DECREF_SET(__pyx_t_2, function);
8164
}
8165
}
8166
if (!__pyx_t_3) {
8167
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inert_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
8168
__Pyx_GOTREF(__pyx_t_1);
8169
} else {
8170
#if CYTHON_FAST_PYCALL
8171
if (PyFunction_Check(__pyx_t_2)) {
8172
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inert_table};
8173
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
8174
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8175
__Pyx_GOTREF(__pyx_t_1);
8176
} else
8177
#endif
8178
#if CYTHON_FAST_PYCCALL
8179
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
8180
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inert_table};
8181
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
8182
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8183
__Pyx_GOTREF(__pyx_t_1);
8184
} else
8185
#endif
8186
{
8187
__pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 332, __pyx_L1_error)
8188
__Pyx_GOTREF(__pyx_t_4);
8189
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
8190
__Pyx_INCREF(__pyx_v_inert_table);
8191
__Pyx_GIVEREF(__pyx_v_inert_table);
8192
PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_inert_table);
8193
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
8194
__Pyx_GOTREF(__pyx_t_1);
8195
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8196
}
8197
}
8198
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8199
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8200
8201
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":333
8202
* self._compute_split_traces()
8203
* self._compute_inert_and_ramified_traces(inert_table)
8204
* self._compute_remaining_traces_naively() # <<<<<<<<<<<<<<
8205
*
8206
* ###############################################################
8207
*/
8208
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compute_remaining_traces_naivel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
8209
__Pyx_GOTREF(__pyx_t_2);
8210
__pyx_t_4 = NULL;
8211
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
8212
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
8213
if (likely(__pyx_t_4)) {
8214
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8215
__Pyx_INCREF(__pyx_t_4);
8216
__Pyx_INCREF(function);
8217
__Pyx_DECREF_SET(__pyx_t_2, function);
8218
}
8219
}
8220
if (__pyx_t_4) {
8221
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
8222
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8223
} else {
8224
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
8225
}
8226
__Pyx_GOTREF(__pyx_t_1);
8227
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8228
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8229
8230
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":330
8231
* return F.ideal([p, 2*F.gen()-1 - s])
8232
*
8233
* def _compute_traces(self, inert_table, algorithm='smalljac'): # <<<<<<<<<<<<<<
8234
* self._compute_split_traces()
8235
* self._compute_inert_and_ramified_traces(inert_table)
8236
*/
8237
8238
/* function exit code */
8239
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
8240
goto __pyx_L0;
8241
__pyx_L1_error:;
8242
__Pyx_XDECREF(__pyx_t_1);
8243
__Pyx_XDECREF(__pyx_t_2);
8244
__Pyx_XDECREF(__pyx_t_3);
8245
__Pyx_XDECREF(__pyx_t_4);
8246
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius._compute_traces", __pyx_clineno, __pyx_lineno, __pyx_filename);
8247
__pyx_r = NULL;
8248
__pyx_L0:;
8249
__Pyx_XGIVEREF(__pyx_r);
8250
__Pyx_RefNannyFinishContext();
8251
return __pyx_r;
8252
}
8253
8254
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":339
8255
* ###############################################################
8256
*
8257
* def inert_primes(N): # <<<<<<<<<<<<<<
8258
* r"""
8259
* Return a list of the inert primes of `\QQ(\sqrt{5})` of norm less than `N`.
8260
*/
8261
8262
/* Python wrapper */
8263
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_5inert_primes(PyObject *__pyx_self, PyObject *__pyx_v_N); /*proto*/
8264
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_4inert_primes[] = "File: sqrt5.pyx (starting at line 339)\n\n Return a list of the inert primes of `\\QQ(\\sqrt{5})` of norm less than `N`.\n\n INPUT:\n - N -- positive integer\n OUTPUT:\n - list of Sage integers\n\n EXAMPLES::\n\n sage: import psage.ellcurve.lseries.sqrt5 as sqrt5\n sage: sqrt5.inert_primes(10^4)\n [2, 3, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97]\n ";
8265
static PyMethodDef __pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_5inert_primes = {"inert_primes", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_5inert_primes, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_4inert_primes};
8266
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_5inert_primes(PyObject *__pyx_self, PyObject *__pyx_v_N) {
8267
PyObject *__pyx_r = 0;
8268
__Pyx_RefNannyDeclarations
8269
__Pyx_RefNannySetupContext("inert_primes (wrapper)", 0);
8270
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_4inert_primes(__pyx_self, ((PyObject *)__pyx_v_N));
8271
8272
/* function exit code */
8273
__Pyx_RefNannyFinishContext();
8274
return __pyx_r;
8275
}
8276
8277
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_4inert_primes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_N) {
8278
PyObject *__pyx_v_sqrt = NULL;
8279
PyObject *__pyx_v_s = NULL;
8280
PyObject *__pyx_v_p = NULL;
8281
PyObject *__pyx_r = NULL;
8282
__Pyx_RefNannyDeclarations
8283
PyObject *__pyx_t_1 = NULL;
8284
PyObject *__pyx_t_2 = NULL;
8285
PyObject *__pyx_t_3 = NULL;
8286
PyObject *__pyx_t_4 = NULL;
8287
PyObject *__pyx_t_5 = NULL;
8288
PyObject *__pyx_t_6 = NULL;
8289
PyObject *__pyx_t_7 = NULL;
8290
Py_ssize_t __pyx_t_8;
8291
PyObject *(*__pyx_t_9)(PyObject *);
8292
int __pyx_t_10;
8293
int __pyx_t_11;
8294
__Pyx_RefNannySetupContext("inert_primes", 0);
8295
8296
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":354
8297
* [2, 3, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97]
8298
* """
8299
* from math import sqrt # <<<<<<<<<<<<<<
8300
* s = set([Integer(2), Integer(3)])
8301
* return [p for p in prime_range(int(sqrt(N))) if p%5 in s]
8302
*/
8303
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
8304
__Pyx_GOTREF(__pyx_t_1);
8305
__Pyx_INCREF(__pyx_n_s_sqrt);
8306
__Pyx_GIVEREF(__pyx_n_s_sqrt);
8307
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_sqrt);
8308
__pyx_t_2 = __Pyx_Import(__pyx_n_s_math, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
8309
__Pyx_GOTREF(__pyx_t_2);
8310
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8311
__pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
8312
__Pyx_GOTREF(__pyx_t_1);
8313
__Pyx_INCREF(__pyx_t_1);
8314
__pyx_v_sqrt = __pyx_t_1;
8315
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8316
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8317
8318
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":355
8319
* """
8320
* from math import sqrt
8321
* s = set([Integer(2), Integer(3)]) # <<<<<<<<<<<<<<
8322
* return [p for p in prime_range(int(sqrt(N))) if p%5 in s]
8323
*
8324
*/
8325
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
8326
__Pyx_GOTREF(__pyx_t_2);
8327
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5rings_7integer_Integer), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
8328
__Pyx_GOTREF(__pyx_t_1);
8329
__pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
8330
__Pyx_GOTREF(__pyx_t_3);
8331
if (PySet_Add(__pyx_t_3, ((PyObject *)__pyx_t_2)) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
8332
if (PySet_Add(__pyx_t_3, ((PyObject *)__pyx_t_1)) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
8333
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8334
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8335
__Pyx_INCREF(__pyx_t_3);
8336
__pyx_v_s = __pyx_t_3;
8337
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8338
8339
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":356
8340
* from math import sqrt
8341
* s = set([Integer(2), Integer(3)])
8342
* return [p for p in prime_range(int(sqrt(N))) if p%5 in s] # <<<<<<<<<<<<<<
8343
*
8344
* from sage.stats.intlist cimport IntList
8345
*/
8346
__Pyx_XDECREF(__pyx_r);
8347
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
8348
__Pyx_GOTREF(__pyx_t_3);
8349
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_prime_range); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
8350
__Pyx_GOTREF(__pyx_t_1);
8351
__Pyx_INCREF(__pyx_v_sqrt);
8352
__pyx_t_5 = __pyx_v_sqrt; __pyx_t_6 = NULL;
8353
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8354
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8355
if (likely(__pyx_t_6)) {
8356
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8357
__Pyx_INCREF(__pyx_t_6);
8358
__Pyx_INCREF(function);
8359
__Pyx_DECREF_SET(__pyx_t_5, function);
8360
}
8361
}
8362
if (!__pyx_t_6) {
8363
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_N); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
8364
__Pyx_GOTREF(__pyx_t_4);
8365
} else {
8366
#if CYTHON_FAST_PYCALL
8367
if (PyFunction_Check(__pyx_t_5)) {
8368
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_N};
8369
__pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
8370
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8371
__Pyx_GOTREF(__pyx_t_4);
8372
} else
8373
#endif
8374
#if CYTHON_FAST_PYCCALL
8375
if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8376
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_N};
8377
__pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
8378
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8379
__Pyx_GOTREF(__pyx_t_4);
8380
} else
8381
#endif
8382
{
8383
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
8384
__Pyx_GOTREF(__pyx_t_7);
8385
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
8386
__Pyx_INCREF(__pyx_v_N);
8387
__Pyx_GIVEREF(__pyx_v_N);
8388
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_N);
8389
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error)
8390
__Pyx_GOTREF(__pyx_t_4);
8391
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8392
}
8393
}
8394
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8395
__pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error)
8396
__Pyx_GOTREF(__pyx_t_5);
8397
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8398
__pyx_t_4 = NULL;
8399
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
8400
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
8401
if (likely(__pyx_t_4)) {
8402
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8403
__Pyx_INCREF(__pyx_t_4);
8404
__Pyx_INCREF(function);
8405
__Pyx_DECREF_SET(__pyx_t_1, function);
8406
}
8407
}
8408
if (!__pyx_t_4) {
8409
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8410
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8411
__Pyx_GOTREF(__pyx_t_2);
8412
} else {
8413
#if CYTHON_FAST_PYCALL
8414
if (PyFunction_Check(__pyx_t_1)) {
8415
PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
8416
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8417
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8418
__Pyx_GOTREF(__pyx_t_2);
8419
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8420
} else
8421
#endif
8422
#if CYTHON_FAST_PYCCALL
8423
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
8424
PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
8425
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8426
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8427
__Pyx_GOTREF(__pyx_t_2);
8428
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8429
} else
8430
#endif
8431
{
8432
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
8433
__Pyx_GOTREF(__pyx_t_7);
8434
__Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
8435
__Pyx_GIVEREF(__pyx_t_5);
8436
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
8437
__pyx_t_5 = 0;
8438
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8439
__Pyx_GOTREF(__pyx_t_2);
8440
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8441
}
8442
}
8443
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8444
if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
8445
__pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
8446
__pyx_t_9 = NULL;
8447
} else {
8448
__pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
8449
__Pyx_GOTREF(__pyx_t_1);
8450
__pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error)
8451
}
8452
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8453
for (;;) {
8454
if (likely(!__pyx_t_9)) {
8455
if (likely(PyList_CheckExact(__pyx_t_1))) {
8456
if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
8457
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8458
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
8459
#else
8460
__pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8461
__Pyx_GOTREF(__pyx_t_2);
8462
#endif
8463
} else {
8464
if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
8465
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8466
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
8467
#else
8468
__pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8469
__Pyx_GOTREF(__pyx_t_2);
8470
#endif
8471
}
8472
} else {
8473
__pyx_t_2 = __pyx_t_9(__pyx_t_1);
8474
if (unlikely(!__pyx_t_2)) {
8475
PyObject* exc_type = PyErr_Occurred();
8476
if (exc_type) {
8477
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
8478
else __PYX_ERR(0, 356, __pyx_L1_error)
8479
}
8480
break;
8481
}
8482
__Pyx_GOTREF(__pyx_t_2);
8483
}
8484
__Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_2);
8485
__pyx_t_2 = 0;
8486
__pyx_t_2 = __Pyx_PyInt_RemainderObjC(__pyx_v_p, __pyx_int_5, 5, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
8487
__Pyx_GOTREF(__pyx_t_2);
8488
__pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_s, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
8489
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8490
__pyx_t_11 = (__pyx_t_10 != 0);
8491
if (__pyx_t_11) {
8492
if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_p))) __PYX_ERR(0, 356, __pyx_L1_error)
8493
}
8494
}
8495
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8496
__pyx_r = __pyx_t_3;
8497
__pyx_t_3 = 0;
8498
goto __pyx_L0;
8499
8500
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":339
8501
* ###############################################################
8502
*
8503
* def inert_primes(N): # <<<<<<<<<<<<<<
8504
* r"""
8505
* Return a list of the inert primes of `\QQ(\sqrt{5})` of norm less than `N`.
8506
*/
8507
8508
/* function exit code */
8509
__pyx_L1_error:;
8510
__Pyx_XDECREF(__pyx_t_1);
8511
__Pyx_XDECREF(__pyx_t_2);
8512
__Pyx_XDECREF(__pyx_t_3);
8513
__Pyx_XDECREF(__pyx_t_4);
8514
__Pyx_XDECREF(__pyx_t_5);
8515
__Pyx_XDECREF(__pyx_t_6);
8516
__Pyx_XDECREF(__pyx_t_7);
8517
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.inert_primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
8518
__pyx_r = NULL;
8519
__pyx_L0:;
8520
__Pyx_XDECREF(__pyx_v_sqrt);
8521
__Pyx_XDECREF(__pyx_v_s);
8522
__Pyx_XDECREF(__pyx_v_p);
8523
__Pyx_XGIVEREF(__pyx_r);
8524
__Pyx_RefNannyFinishContext();
8525
return __pyx_r;
8526
}
8527
8528
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":360
8529
* from sage.stats.intlist cimport IntList
8530
*
8531
* def unpickle_InertTraceCalculator(tables): # <<<<<<<<<<<<<<
8532
* C = InertTraceCalculator()
8533
* C.tables = tables
8534
*/
8535
8536
/* Python wrapper */
8537
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_7unpickle_InertTraceCalculator(PyObject *__pyx_self, PyObject *__pyx_v_tables); /*proto*/
8538
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_6unpickle_InertTraceCalculator[] = "File: sqrt5.pyx (starting at line 360)";
8539
static PyMethodDef __pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_7unpickle_InertTraceCalculator = {"unpickle_InertTraceCalculator", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_7unpickle_InertTraceCalculator, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_6unpickle_InertTraceCalculator};
8540
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_7unpickle_InertTraceCalculator(PyObject *__pyx_self, PyObject *__pyx_v_tables) {
8541
PyObject *__pyx_r = 0;
8542
__Pyx_RefNannyDeclarations
8543
__Pyx_RefNannySetupContext("unpickle_InertTraceCalculator (wrapper)", 0);
8544
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_6unpickle_InertTraceCalculator(__pyx_self, ((PyObject *)__pyx_v_tables));
8545
8546
/* function exit code */
8547
__Pyx_RefNannyFinishContext();
8548
return __pyx_r;
8549
}
8550
8551
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_6unpickle_InertTraceCalculator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tables) {
8552
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_C = NULL;
8553
PyObject *__pyx_r = NULL;
8554
__Pyx_RefNannyDeclarations
8555
PyObject *__pyx_t_1 = NULL;
8556
__Pyx_RefNannySetupContext("unpickle_InertTraceCalculator", 0);
8557
8558
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":361
8559
*
8560
* def unpickle_InertTraceCalculator(tables):
8561
* C = InertTraceCalculator() # <<<<<<<<<<<<<<
8562
* C.tables = tables
8563
* return C
8564
*/
8565
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
8566
__Pyx_GOTREF(__pyx_t_1);
8567
__pyx_v_C = ((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_t_1);
8568
__pyx_t_1 = 0;
8569
8570
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":362
8571
* def unpickle_InertTraceCalculator(tables):
8572
* C = InertTraceCalculator()
8573
* C.tables = tables # <<<<<<<<<<<<<<
8574
* return C
8575
*
8576
*/
8577
if (!(likely(PyDict_CheckExact(__pyx_v_tables))||((__pyx_v_tables) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_tables)->tp_name), 0))) __PYX_ERR(0, 362, __pyx_L1_error)
8578
__pyx_t_1 = __pyx_v_tables;
8579
__Pyx_INCREF(__pyx_t_1);
8580
__Pyx_GIVEREF(__pyx_t_1);
8581
__Pyx_GOTREF(__pyx_v_C->tables);
8582
__Pyx_DECREF(__pyx_v_C->tables);
8583
__pyx_v_C->tables = ((PyObject*)__pyx_t_1);
8584
__pyx_t_1 = 0;
8585
8586
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":363
8587
* C = InertTraceCalculator()
8588
* C.tables = tables
8589
* return C # <<<<<<<<<<<<<<
8590
*
8591
* cdef class InertTraceCalculator:
8592
*/
8593
__Pyx_XDECREF(__pyx_r);
8594
__Pyx_INCREF(((PyObject *)__pyx_v_C));
8595
__pyx_r = ((PyObject *)__pyx_v_C);
8596
goto __pyx_L0;
8597
8598
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":360
8599
* from sage.stats.intlist cimport IntList
8600
*
8601
* def unpickle_InertTraceCalculator(tables): # <<<<<<<<<<<<<<
8602
* C = InertTraceCalculator()
8603
* C.tables = tables
8604
*/
8605
8606
/* function exit code */
8607
__pyx_L1_error:;
8608
__Pyx_XDECREF(__pyx_t_1);
8609
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.unpickle_InertTraceCalculator", __pyx_clineno, __pyx_lineno, __pyx_filename);
8610
__pyx_r = NULL;
8611
__pyx_L0:;
8612
__Pyx_XDECREF((PyObject *)__pyx_v_C);
8613
__Pyx_XGIVEREF(__pyx_r);
8614
__Pyx_RefNannyFinishContext();
8615
return __pyx_r;
8616
}
8617
8618
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":368
8619
* cdef public dict tables
8620
*
8621
* def __init__(self): # <<<<<<<<<<<<<<
8622
* self.tables = {}
8623
*
8624
*/
8625
8626
/* Python wrapper */
8627
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8628
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__[] = "File: sqrt5.pyx (starting at line 368)";
8629
#if CYTHON_COMPILING_IN_CPYTHON
8630
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__;
8631
#endif
8632
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8633
int __pyx_r;
8634
__Pyx_RefNannyDeclarations
8635
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8636
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
8637
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
8638
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
8639
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self));
8640
8641
/* function exit code */
8642
__Pyx_RefNannyFinishContext();
8643
return __pyx_r;
8644
}
8645
8646
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self) {
8647
int __pyx_r;
8648
__Pyx_RefNannyDeclarations
8649
PyObject *__pyx_t_1 = NULL;
8650
__Pyx_RefNannySetupContext("__init__", 0);
8651
8652
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":369
8653
*
8654
* def __init__(self):
8655
* self.tables = {} # <<<<<<<<<<<<<<
8656
*
8657
* def __repr__(self):
8658
*/
8659
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
8660
__Pyx_GOTREF(__pyx_t_1);
8661
__Pyx_GIVEREF(__pyx_t_1);
8662
__Pyx_GOTREF(__pyx_v_self->tables);
8663
__Pyx_DECREF(__pyx_v_self->tables);
8664
__pyx_v_self->tables = ((PyObject*)__pyx_t_1);
8665
__pyx_t_1 = 0;
8666
8667
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":368
8668
* cdef public dict tables
8669
*
8670
* def __init__(self): # <<<<<<<<<<<<<<
8671
* self.tables = {}
8672
*
8673
*/
8674
8675
/* function exit code */
8676
__pyx_r = 0;
8677
goto __pyx_L0;
8678
__pyx_L1_error:;
8679
__Pyx_XDECREF(__pyx_t_1);
8680
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8681
__pyx_r = -1;
8682
__pyx_L0:;
8683
__Pyx_RefNannyFinishContext();
8684
return __pyx_r;
8685
}
8686
8687
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":371
8688
* self.tables = {}
8689
*
8690
* def __repr__(self): # <<<<<<<<<<<<<<
8691
* return "Inert trace calculator with precomputed tables for p in {%s}"%(sorted(self.tables.keys()))
8692
*
8693
*/
8694
8695
/* Python wrapper */
8696
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_3__repr__(PyObject *__pyx_v_self); /*proto*/
8697
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__[] = "File: sqrt5.pyx (starting at line 371)";
8698
#if CYTHON_COMPILING_IN_CPYTHON
8699
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__;
8700
#endif
8701
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_3__repr__(PyObject *__pyx_v_self) {
8702
PyObject *__pyx_r = 0;
8703
__Pyx_RefNannyDeclarations
8704
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
8705
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self));
8706
8707
/* function exit code */
8708
__Pyx_RefNannyFinishContext();
8709
return __pyx_r;
8710
}
8711
8712
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self) {
8713
PyObject *__pyx_r = NULL;
8714
__Pyx_RefNannyDeclarations
8715
PyObject *__pyx_t_1 = NULL;
8716
PyObject *__pyx_t_2 = NULL;
8717
PyObject *__pyx_t_3 = NULL;
8718
int __pyx_t_4;
8719
__Pyx_RefNannySetupContext("__repr__", 0);
8720
8721
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":372
8722
*
8723
* def __repr__(self):
8724
* return "Inert trace calculator with precomputed tables for p in {%s}"%(sorted(self.tables.keys())) # <<<<<<<<<<<<<<
8725
*
8726
* def __reduce__(self):
8727
*/
8728
__Pyx_XDECREF(__pyx_r);
8729
if (unlikely(__pyx_v_self->tables == Py_None)) {
8730
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys");
8731
__PYX_ERR(0, 372, __pyx_L1_error)
8732
}
8733
__pyx_t_2 = __Pyx_PyDict_Keys(__pyx_v_self->tables); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
8734
__Pyx_GOTREF(__pyx_t_2);
8735
__pyx_t_3 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
8736
__Pyx_GOTREF(__pyx_t_3);
8737
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8738
__pyx_t_1 = ((PyObject*)__pyx_t_3);
8739
__pyx_t_3 = 0;
8740
__pyx_t_4 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 372, __pyx_L1_error)
8741
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Inert_trace_calculator_with_prec, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
8742
__Pyx_GOTREF(__pyx_t_3);
8743
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8744
__pyx_r = __pyx_t_3;
8745
__pyx_t_3 = 0;
8746
goto __pyx_L0;
8747
8748
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":371
8749
* self.tables = {}
8750
*
8751
* def __repr__(self): # <<<<<<<<<<<<<<
8752
* return "Inert trace calculator with precomputed tables for p in {%s}"%(sorted(self.tables.keys()))
8753
*
8754
*/
8755
8756
/* function exit code */
8757
__pyx_L1_error:;
8758
__Pyx_XDECREF(__pyx_t_1);
8759
__Pyx_XDECREF(__pyx_t_2);
8760
__Pyx_XDECREF(__pyx_t_3);
8761
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8762
__pyx_r = NULL;
8763
__pyx_L0:;
8764
__Pyx_XGIVEREF(__pyx_r);
8765
__Pyx_RefNannyFinishContext();
8766
return __pyx_r;
8767
}
8768
8769
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":374
8770
* return "Inert trace calculator with precomputed tables for p in {%s}"%(sorted(self.tables.keys()))
8771
*
8772
* def __reduce__(self): # <<<<<<<<<<<<<<
8773
* return unpickle_InertTraceCalculator, (self.tables, )
8774
*
8775
*/
8776
8777
/* Python wrapper */
8778
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
8779
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_4__reduce__[] = "File: sqrt5.pyx (starting at line 374)";
8780
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8781
PyObject *__pyx_r = 0;
8782
__Pyx_RefNannyDeclarations
8783
__Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
8784
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_4__reduce__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self));
8785
8786
/* function exit code */
8787
__Pyx_RefNannyFinishContext();
8788
return __pyx_r;
8789
}
8790
8791
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_4__reduce__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self) {
8792
PyObject *__pyx_r = NULL;
8793
__Pyx_RefNannyDeclarations
8794
PyObject *__pyx_t_1 = NULL;
8795
PyObject *__pyx_t_2 = NULL;
8796
PyObject *__pyx_t_3 = NULL;
8797
__Pyx_RefNannySetupContext("__reduce__", 0);
8798
8799
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":375
8800
*
8801
* def __reduce__(self):
8802
* return unpickle_InertTraceCalculator, (self.tables, ) # <<<<<<<<<<<<<<
8803
*
8804
* cpdef long trace_of_frobenius(self, j0, c_quo0, long p) except 9223372036854775808:
8805
*/
8806
__Pyx_XDECREF(__pyx_r);
8807
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unpickle_InertTraceCalculator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error)
8808
__Pyx_GOTREF(__pyx_t_1);
8809
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error)
8810
__Pyx_GOTREF(__pyx_t_2);
8811
__Pyx_INCREF(__pyx_v_self->tables);
8812
__Pyx_GIVEREF(__pyx_v_self->tables);
8813
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->tables);
8814
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
8815
__Pyx_GOTREF(__pyx_t_3);
8816
__Pyx_GIVEREF(__pyx_t_1);
8817
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
8818
__Pyx_GIVEREF(__pyx_t_2);
8819
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
8820
__pyx_t_1 = 0;
8821
__pyx_t_2 = 0;
8822
__pyx_r = __pyx_t_3;
8823
__pyx_t_3 = 0;
8824
goto __pyx_L0;
8825
8826
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":374
8827
* return "Inert trace calculator with precomputed tables for p in {%s}"%(sorted(self.tables.keys()))
8828
*
8829
* def __reduce__(self): # <<<<<<<<<<<<<<
8830
* return unpickle_InertTraceCalculator, (self.tables, )
8831
*
8832
*/
8833
8834
/* function exit code */
8835
__pyx_L1_error:;
8836
__Pyx_XDECREF(__pyx_t_1);
8837
__Pyx_XDECREF(__pyx_t_2);
8838
__Pyx_XDECREF(__pyx_t_3);
8839
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8840
__pyx_r = NULL;
8841
__pyx_L0:;
8842
__Pyx_XGIVEREF(__pyx_r);
8843
__Pyx_RefNannyFinishContext();
8844
return __pyx_r;
8845
}
8846
8847
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":377
8848
* return unpickle_InertTraceCalculator, (self.tables, )
8849
*
8850
* cpdef long trace_of_frobenius(self, j0, c_quo0, long p) except 9223372036854775808: # <<<<<<<<<<<<<<
8851
* T = self.tables[p]
8852
* cdef ResidueRing_abstract R = T['R']
8853
*/
8854
8855
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_7trace_of_frobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8856
static long __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_trace_of_frobenius(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, PyObject *__pyx_v_j0, PyObject *__pyx_v_c_quo0, long __pyx_v_p, int __pyx_skip_dispatch) {
8857
PyObject *__pyx_v_T = NULL;
8858
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R = 0;
8859
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_j = 0;
8860
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *__pyx_v_c_quo = 0;
8861
int __pyx_v_i;
8862
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_ap = 0;
8863
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_c_quos = 0;
8864
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_squares = 0;
8865
long __pyx_v_a;
8866
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_z;
8867
long __pyx_r;
8868
__Pyx_RefNannyDeclarations
8869
PyObject *__pyx_t_1 = NULL;
8870
PyObject *__pyx_t_2 = NULL;
8871
PyObject *__pyx_t_3 = NULL;
8872
PyObject *__pyx_t_4 = NULL;
8873
PyObject *__pyx_t_5 = NULL;
8874
int __pyx_t_6;
8875
PyObject *__pyx_t_7 = NULL;
8876
long __pyx_t_8;
8877
int __pyx_t_9;
8878
int __pyx_t_10;
8879
__Pyx_RefNannySetupContext("trace_of_frobenius", 0);
8880
/* Check if called by wrapper */
8881
if (unlikely(__pyx_skip_dispatch)) ;
8882
/* Check if overridden in Python */
8883
else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
8884
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_trace_of_frobenius); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error)
8885
__Pyx_GOTREF(__pyx_t_1);
8886
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_7trace_of_frobenius)) {
8887
__pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error)
8888
__Pyx_GOTREF(__pyx_t_3);
8889
__Pyx_INCREF(__pyx_t_1);
8890
__pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
8891
__pyx_t_6 = 0;
8892
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
8893
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
8894
if (likely(__pyx_t_5)) {
8895
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
8896
__Pyx_INCREF(__pyx_t_5);
8897
__Pyx_INCREF(function);
8898
__Pyx_DECREF_SET(__pyx_t_4, function);
8899
__pyx_t_6 = 1;
8900
}
8901
}
8902
#if CYTHON_FAST_PYCALL
8903
if (PyFunction_Check(__pyx_t_4)) {
8904
PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_j0, __pyx_v_c_quo0, __pyx_t_3};
8905
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
8906
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8907
__Pyx_GOTREF(__pyx_t_2);
8908
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8909
} else
8910
#endif
8911
#if CYTHON_FAST_PYCCALL
8912
if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
8913
PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_j0, __pyx_v_c_quo0, __pyx_t_3};
8914
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
8915
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
8916
__Pyx_GOTREF(__pyx_t_2);
8917
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8918
} else
8919
#endif
8920
{
8921
__pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 377, __pyx_L1_error)
8922
__Pyx_GOTREF(__pyx_t_7);
8923
if (__pyx_t_5) {
8924
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
8925
}
8926
__Pyx_INCREF(__pyx_v_j0);
8927
__Pyx_GIVEREF(__pyx_v_j0);
8928
PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_j0);
8929
__Pyx_INCREF(__pyx_v_c_quo0);
8930
__Pyx_GIVEREF(__pyx_v_c_quo0);
8931
PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_c_quo0);
8932
__Pyx_GIVEREF(__pyx_t_3);
8933
PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_3);
8934
__pyx_t_3 = 0;
8935
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
8936
__Pyx_GOTREF(__pyx_t_2);
8937
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8938
}
8939
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8940
__pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L1_error)
8941
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8942
__pyx_r = __pyx_t_8;
8943
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8944
goto __pyx_L0;
8945
}
8946
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8947
}
8948
8949
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":378
8950
*
8951
* cpdef long trace_of_frobenius(self, j0, c_quo0, long p) except 9223372036854775808:
8952
* T = self.tables[p] # <<<<<<<<<<<<<<
8953
* cdef ResidueRing_abstract R = T['R']
8954
* cdef ResidueRingElement j = R(j0), c_quo = R(c_quo0)
8955
*/
8956
if (unlikely(__pyx_v_self->tables == Py_None)) {
8957
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8958
__PYX_ERR(0, 378, __pyx_L1_error)
8959
}
8960
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
8961
__Pyx_GOTREF(__pyx_t_1);
8962
__pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->tables, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error)
8963
__Pyx_GOTREF(__pyx_t_2);
8964
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8965
__pyx_v_T = __pyx_t_2;
8966
__pyx_t_2 = 0;
8967
8968
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":379
8969
* cpdef long trace_of_frobenius(self, j0, c_quo0, long p) except 9223372036854775808:
8970
* T = self.tables[p]
8971
* cdef ResidueRing_abstract R = T['R'] # <<<<<<<<<<<<<<
8972
* cdef ResidueRingElement j = R(j0), c_quo = R(c_quo0)
8973
* if R.element_is_0(j.x) or j.x[0]==1728%p and j.x[1]==0:
8974
*/
8975
__pyx_t_2 = PyObject_GetItem(__pyx_v_T, __pyx_n_s_R); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
8976
__Pyx_GOTREF(__pyx_t_2);
8977
if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract))))) __PYX_ERR(0, 379, __pyx_L1_error)
8978
__pyx_v_R = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_t_2);
8979
__pyx_t_2 = 0;
8980
8981
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":380
8982
* T = self.tables[p]
8983
* cdef ResidueRing_abstract R = T['R']
8984
* cdef ResidueRingElement j = R(j0), c_quo = R(c_quo0) # <<<<<<<<<<<<<<
8985
* if R.element_is_0(j.x) or j.x[0]==1728%p and j.x[1]==0:
8986
* raise NotImplementedError
8987
*/
8988
__Pyx_INCREF(((PyObject *)__pyx_v_R));
8989
__pyx_t_1 = ((PyObject *)__pyx_v_R); __pyx_t_4 = NULL;
8990
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
8991
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
8992
if (likely(__pyx_t_4)) {
8993
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8994
__Pyx_INCREF(__pyx_t_4);
8995
__Pyx_INCREF(function);
8996
__Pyx_DECREF_SET(__pyx_t_1, function);
8997
}
8998
}
8999
if (!__pyx_t_4) {
9000
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_j0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9001
__Pyx_GOTREF(__pyx_t_2);
9002
} else {
9003
#if CYTHON_FAST_PYCALL
9004
if (PyFunction_Check(__pyx_t_1)) {
9005
PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_j0};
9006
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9007
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9008
__Pyx_GOTREF(__pyx_t_2);
9009
} else
9010
#endif
9011
#if CYTHON_FAST_PYCCALL
9012
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
9013
PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_j0};
9014
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9015
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9016
__Pyx_GOTREF(__pyx_t_2);
9017
} else
9018
#endif
9019
{
9020
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error)
9021
__Pyx_GOTREF(__pyx_t_7);
9022
__Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
9023
__Pyx_INCREF(__pyx_v_j0);
9024
__Pyx_GIVEREF(__pyx_v_j0);
9025
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_j0);
9026
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9027
__Pyx_GOTREF(__pyx_t_2);
9028
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9029
}
9030
}
9031
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9032
if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement))))) __PYX_ERR(0, 380, __pyx_L1_error)
9033
__pyx_v_j = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *)__pyx_t_2);
9034
__pyx_t_2 = 0;
9035
__Pyx_INCREF(((PyObject *)__pyx_v_R));
9036
__pyx_t_1 = ((PyObject *)__pyx_v_R); __pyx_t_7 = NULL;
9037
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
9038
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
9039
if (likely(__pyx_t_7)) {
9040
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
9041
__Pyx_INCREF(__pyx_t_7);
9042
__Pyx_INCREF(function);
9043
__Pyx_DECREF_SET(__pyx_t_1, function);
9044
}
9045
}
9046
if (!__pyx_t_7) {
9047
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_c_quo0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9048
__Pyx_GOTREF(__pyx_t_2);
9049
} else {
9050
#if CYTHON_FAST_PYCALL
9051
if (PyFunction_Check(__pyx_t_1)) {
9052
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_c_quo0};
9053
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9054
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9055
__Pyx_GOTREF(__pyx_t_2);
9056
} else
9057
#endif
9058
#if CYTHON_FAST_PYCCALL
9059
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
9060
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_c_quo0};
9061
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9062
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9063
__Pyx_GOTREF(__pyx_t_2);
9064
} else
9065
#endif
9066
{
9067
__pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error)
9068
__Pyx_GOTREF(__pyx_t_4);
9069
__Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
9070
__Pyx_INCREF(__pyx_v_c_quo0);
9071
__Pyx_GIVEREF(__pyx_v_c_quo0);
9072
PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_c_quo0);
9073
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
9074
__Pyx_GOTREF(__pyx_t_2);
9075
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9076
}
9077
}
9078
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9079
if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement))))) __PYX_ERR(0, 380, __pyx_L1_error)
9080
__pyx_v_c_quo = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRingElement *)__pyx_t_2);
9081
__pyx_t_2 = 0;
9082
9083
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":381
9084
* cdef ResidueRing_abstract R = T['R']
9085
* cdef ResidueRingElement j = R(j0), c_quo = R(c_quo0)
9086
* if R.element_is_0(j.x) or j.x[0]==1728%p and j.x[1]==0: # <<<<<<<<<<<<<<
9087
* raise NotImplementedError
9088
*
9089
*/
9090
__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)->element_is_0(__pyx_v_R, __pyx_v_j->x) != 0);
9091
if (!__pyx_t_10) {
9092
} else {
9093
__pyx_t_9 = __pyx_t_10;
9094
goto __pyx_L4_bool_binop_done;
9095
}
9096
if (unlikely(__pyx_v_p == 0)) {
9097
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
9098
__PYX_ERR(0, 381, __pyx_L1_error)
9099
}
9100
__pyx_t_10 = (((__pyx_v_j->x[0]) == __Pyx_mod_long(0x6C0, __pyx_v_p)) != 0);
9101
if (__pyx_t_10) {
9102
} else {
9103
__pyx_t_9 = __pyx_t_10;
9104
goto __pyx_L4_bool_binop_done;
9105
}
9106
__pyx_t_10 = (((__pyx_v_j->x[1]) == 0) != 0);
9107
__pyx_t_9 = __pyx_t_10;
9108
__pyx_L4_bool_binop_done:;
9109
if (__pyx_t_9) {
9110
9111
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":382
9112
* cdef ResidueRingElement j = R(j0), c_quo = R(c_quo0)
9113
* if R.element_is_0(j.x) or j.x[0]==1728%p and j.x[1]==0:
9114
* raise NotImplementedError # <<<<<<<<<<<<<<
9115
*
9116
* cdef int i = R.index_of_element(j.x)
9117
*/
9118
__Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
9119
__PYX_ERR(0, 382, __pyx_L1_error)
9120
9121
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":381
9122
* cdef ResidueRing_abstract R = T['R']
9123
* cdef ResidueRingElement j = R(j0), c_quo = R(c_quo0)
9124
* if R.element_is_0(j.x) or j.x[0]==1728%p and j.x[1]==0: # <<<<<<<<<<<<<<
9125
* raise NotImplementedError
9126
*
9127
*/
9128
}
9129
9130
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":384
9131
* raise NotImplementedError
9132
*
9133
* cdef int i = R.index_of_element(j.x) # <<<<<<<<<<<<<<
9134
*
9135
* cdef IntList ap = T['ap'], c_quos = T['c_quo'], squares = T['squares']
9136
*/
9137
__pyx_t_8 = ((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)->index_of_element(__pyx_v_R, __pyx_v_j->x); if (unlikely(__pyx_t_8 == -1L)) __PYX_ERR(0, 384, __pyx_L1_error)
9138
__pyx_v_i = __pyx_t_8;
9139
9140
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":386
9141
* cdef int i = R.index_of_element(j.x)
9142
*
9143
* cdef IntList ap = T['ap'], c_quos = T['c_quo'], squares = T['squares'] # <<<<<<<<<<<<<<
9144
* cdef long a = ap[i]
9145
* cdef residue_element z
9146
*/
9147
__pyx_t_2 = PyObject_GetItem(__pyx_v_T, __pyx_n_s_ap); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
9148
__Pyx_GOTREF(__pyx_t_2);
9149
if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4sage_5stats_7intlist_IntList))))) __PYX_ERR(0, 386, __pyx_L1_error)
9150
__pyx_v_ap = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_2);
9151
__pyx_t_2 = 0;
9152
__pyx_t_2 = PyObject_GetItem(__pyx_v_T, __pyx_n_s_c_quo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
9153
__Pyx_GOTREF(__pyx_t_2);
9154
if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4sage_5stats_7intlist_IntList))))) __PYX_ERR(0, 386, __pyx_L1_error)
9155
__pyx_v_c_quos = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_2);
9156
__pyx_t_2 = 0;
9157
__pyx_t_2 = PyObject_GetItem(__pyx_v_T, __pyx_n_s_squares); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error)
9158
__Pyx_GOTREF(__pyx_t_2);
9159
if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4sage_5stats_7intlist_IntList))))) __PYX_ERR(0, 386, __pyx_L1_error)
9160
__pyx_v_squares = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_2);
9161
__pyx_t_2 = 0;
9162
9163
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":387
9164
*
9165
* cdef IntList ap = T['ap'], c_quos = T['c_quo'], squares = T['squares']
9166
* cdef long a = ap[i] # <<<<<<<<<<<<<<
9167
* cdef residue_element z
9168
* R.ith_element(z, c_quos[i])
9169
*/
9170
__pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_ap), __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error)
9171
__Pyx_GOTREF(__pyx_t_2);
9172
__pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 387, __pyx_L1_error)
9173
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9174
__pyx_v_a = __pyx_t_8;
9175
9176
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":389
9177
* cdef long a = ap[i]
9178
* cdef residue_element z
9179
* R.ith_element(z, c_quos[i]) # <<<<<<<<<<<<<<
9180
* R.mul(z, z, c_quo.x)
9181
* if not squares[R.index_of_element(z)]: # not a square, so curves are not isomorphic, so there is a quadratic twist
9182
*/
9183
__pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_c_quos), __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
9184
__Pyx_GOTREF(__pyx_t_2);
9185
__pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L1_error)
9186
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9187
__pyx_t_6 = ((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)->ith_element(__pyx_v_R, __pyx_v_z, __pyx_t_8); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 389, __pyx_L1_error)
9188
9189
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":390
9190
* cdef residue_element z
9191
* R.ith_element(z, c_quos[i])
9192
* R.mul(z, z, c_quo.x) # <<<<<<<<<<<<<<
9193
* if not squares[R.index_of_element(z)]: # not a square, so curves are not isomorphic, so there is a quadratic twist
9194
* return -a
9195
*/
9196
((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_c_quo->x);
9197
9198
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":391
9199
* R.ith_element(z, c_quos[i])
9200
* R.mul(z, z, c_quo.x)
9201
* if not squares[R.index_of_element(z)]: # not a square, so curves are not isomorphic, so there is a quadratic twist # <<<<<<<<<<<<<<
9202
* return -a
9203
* else:
9204
*/
9205
__pyx_t_8 = ((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)->index_of_element(__pyx_v_R, __pyx_v_z); if (unlikely(__pyx_t_8 == -1L)) __PYX_ERR(0, 391, __pyx_L1_error)
9206
__pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_squares), __pyx_t_8, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
9207
__Pyx_GOTREF(__pyx_t_2);
9208
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
9209
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9210
__pyx_t_10 = ((!__pyx_t_9) != 0);
9211
if (__pyx_t_10) {
9212
9213
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":392
9214
* R.mul(z, z, c_quo.x)
9215
* if not squares[R.index_of_element(z)]: # not a square, so curves are not isomorphic, so there is a quadratic twist
9216
* return -a # <<<<<<<<<<<<<<
9217
* else:
9218
* return a
9219
*/
9220
__pyx_r = (-__pyx_v_a);
9221
goto __pyx_L0;
9222
9223
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":391
9224
* R.ith_element(z, c_quos[i])
9225
* R.mul(z, z, c_quo.x)
9226
* if not squares[R.index_of_element(z)]: # not a square, so curves are not isomorphic, so there is a quadratic twist # <<<<<<<<<<<<<<
9227
* return -a
9228
* else:
9229
*/
9230
}
9231
9232
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":394
9233
* return -a
9234
* else:
9235
* return a # <<<<<<<<<<<<<<
9236
*
9237
*
9238
*/
9239
/*else*/ {
9240
__pyx_r = __pyx_v_a;
9241
goto __pyx_L0;
9242
}
9243
9244
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":377
9245
* return unpickle_InertTraceCalculator, (self.tables, )
9246
*
9247
* cpdef long trace_of_frobenius(self, j0, c_quo0, long p) except 9223372036854775808: # <<<<<<<<<<<<<<
9248
* T = self.tables[p]
9249
* cdef ResidueRing_abstract R = T['R']
9250
*/
9251
9252
/* function exit code */
9253
__pyx_L1_error:;
9254
__Pyx_XDECREF(__pyx_t_1);
9255
__Pyx_XDECREF(__pyx_t_2);
9256
__Pyx_XDECREF(__pyx_t_3);
9257
__Pyx_XDECREF(__pyx_t_4);
9258
__Pyx_XDECREF(__pyx_t_5);
9259
__Pyx_XDECREF(__pyx_t_7);
9260
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.trace_of_frobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
9261
__pyx_r = 0x8000000000000000;
9262
__pyx_L0:;
9263
__Pyx_XDECREF(__pyx_v_T);
9264
__Pyx_XDECREF((PyObject *)__pyx_v_R);
9265
__Pyx_XDECREF((PyObject *)__pyx_v_j);
9266
__Pyx_XDECREF((PyObject *)__pyx_v_c_quo);
9267
__Pyx_XDECREF((PyObject *)__pyx_v_ap);
9268
__Pyx_XDECREF((PyObject *)__pyx_v_c_quos);
9269
__Pyx_XDECREF((PyObject *)__pyx_v_squares);
9270
__Pyx_RefNannyFinishContext();
9271
return __pyx_r;
9272
}
9273
9274
/* Python wrapper */
9275
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_7trace_of_frobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9276
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6trace_of_frobenius[] = "File: sqrt5.pyx (starting at line 377)";
9277
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_7trace_of_frobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9278
PyObject *__pyx_v_j0 = 0;
9279
PyObject *__pyx_v_c_quo0 = 0;
9280
long __pyx_v_p;
9281
PyObject *__pyx_r = 0;
9282
__Pyx_RefNannyDeclarations
9283
__Pyx_RefNannySetupContext("trace_of_frobenius (wrapper)", 0);
9284
{
9285
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_j0,&__pyx_n_s_c_quo0,&__pyx_n_s_p,0};
9286
PyObject* values[3] = {0,0,0};
9287
if (unlikely(__pyx_kwds)) {
9288
Py_ssize_t kw_args;
9289
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9290
switch (pos_args) {
9291
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9292
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9293
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9294
case 0: break;
9295
default: goto __pyx_L5_argtuple_error;
9296
}
9297
kw_args = PyDict_Size(__pyx_kwds);
9298
switch (pos_args) {
9299
case 0:
9300
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_j0)) != 0)) kw_args--;
9301
else goto __pyx_L5_argtuple_error;
9302
case 1:
9303
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c_quo0)) != 0)) kw_args--;
9304
else {
9305
__Pyx_RaiseArgtupleInvalid("trace_of_frobenius", 1, 3, 3, 1); __PYX_ERR(0, 377, __pyx_L3_error)
9306
}
9307
case 2:
9308
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
9309
else {
9310
__Pyx_RaiseArgtupleInvalid("trace_of_frobenius", 1, 3, 3, 2); __PYX_ERR(0, 377, __pyx_L3_error)
9311
}
9312
}
9313
if (unlikely(kw_args > 0)) {
9314
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trace_of_frobenius") < 0)) __PYX_ERR(0, 377, __pyx_L3_error)
9315
}
9316
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
9317
goto __pyx_L5_argtuple_error;
9318
} else {
9319
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9320
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9321
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9322
}
9323
__pyx_v_j0 = values[0];
9324
__pyx_v_c_quo0 = values[1];
9325
__pyx_v_p = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L3_error)
9326
}
9327
goto __pyx_L4_argument_unpacking_done;
9328
__pyx_L5_argtuple_error:;
9329
__Pyx_RaiseArgtupleInvalid("trace_of_frobenius", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 377, __pyx_L3_error)
9330
__pyx_L3_error:;
9331
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.trace_of_frobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
9332
__Pyx_RefNannyFinishContext();
9333
return NULL;
9334
__pyx_L4_argument_unpacking_done:;
9335
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6trace_of_frobenius(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self), __pyx_v_j0, __pyx_v_c_quo0, __pyx_v_p);
9336
9337
/* function exit code */
9338
__Pyx_RefNannyFinishContext();
9339
return __pyx_r;
9340
}
9341
9342
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6trace_of_frobenius(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, PyObject *__pyx_v_j0, PyObject *__pyx_v_c_quo0, long __pyx_v_p) {
9343
PyObject *__pyx_r = NULL;
9344
__Pyx_RefNannyDeclarations
9345
long __pyx_t_1;
9346
PyObject *__pyx_t_2 = NULL;
9347
__Pyx_RefNannySetupContext("trace_of_frobenius", 0);
9348
__Pyx_XDECREF(__pyx_r);
9349
__pyx_t_1 = __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_trace_of_frobenius(__pyx_v_self, __pyx_v_j0, __pyx_v_c_quo0, __pyx_v_p, 1); if (unlikely(__pyx_t_1 == 0x8000000000000000)) __PYX_ERR(0, 377, __pyx_L1_error)
9350
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
9351
__Pyx_GOTREF(__pyx_t_2);
9352
__pyx_r = __pyx_t_2;
9353
__pyx_t_2 = 0;
9354
goto __pyx_L0;
9355
9356
/* function exit code */
9357
__pyx_L1_error:;
9358
__Pyx_XDECREF(__pyx_t_2);
9359
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.trace_of_frobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
9360
__pyx_r = NULL;
9361
__pyx_L0:;
9362
__Pyx_XGIVEREF(__pyx_r);
9363
__Pyx_RefNannyFinishContext();
9364
return __pyx_r;
9365
}
9366
9367
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":397
9368
*
9369
*
9370
* def init_table(self, int p): # <<<<<<<<<<<<<<
9371
* assert p >= 7 and (p%5 == 2 or p%5 == 3) # inert prime >= 7
9372
* if self.tables.has_key(p):
9373
*/
9374
9375
/* Python wrapper */
9376
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_9init_table(PyObject *__pyx_v_self, PyObject *__pyx_arg_p); /*proto*/
9377
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_8init_table[] = "File: sqrt5.pyx (starting at line 397)";
9378
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_9init_table(PyObject *__pyx_v_self, PyObject *__pyx_arg_p) {
9379
int __pyx_v_p;
9380
PyObject *__pyx_r = 0;
9381
__Pyx_RefNannyDeclarations
9382
__Pyx_RefNannySetupContext("init_table (wrapper)", 0);
9383
assert(__pyx_arg_p); {
9384
__pyx_v_p = __Pyx_PyInt_As_int(__pyx_arg_p); if (unlikely((__pyx_v_p == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 397, __pyx_L3_error)
9385
}
9386
goto __pyx_L4_argument_unpacking_done;
9387
__pyx_L3_error:;
9388
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.init_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
9389
__Pyx_RefNannyFinishContext();
9390
return NULL;
9391
__pyx_L4_argument_unpacking_done:;
9392
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_8init_table(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self), ((int)__pyx_v_p));
9393
9394
/* function exit code */
9395
__Pyx_RefNannyFinishContext();
9396
return __pyx_r;
9397
}
9398
9399
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_8init_table(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, int __pyx_v_p) {
9400
PyObject *__pyx_v_F = NULL;
9401
struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R = 0;
9402
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_ap = 0;
9403
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_c_quo = 0;
9404
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_squares = NULL;
9405
struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_cubes = 0;
9406
long __pyx_v_i;
9407
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_j;
9408
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_a4;
9409
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_a6;
9410
PyObject *__pyx_r = NULL;
9411
__Pyx_RefNannyDeclarations
9412
int __pyx_t_1;
9413
int __pyx_t_2;
9414
PyObject *__pyx_t_3 = NULL;
9415
PyObject *__pyx_t_4 = NULL;
9416
PyObject *__pyx_t_5 = NULL;
9417
PyObject *__pyx_t_6 = NULL;
9418
PyObject *__pyx_t_7 = NULL;
9419
PyObject *__pyx_t_8 = NULL;
9420
PyObject *__pyx_t_9 = NULL;
9421
int __pyx_t_10;
9422
long __pyx_t_11;
9423
long __pyx_t_12;
9424
__Pyx_RefNannySetupContext("init_table", 0);
9425
9426
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":398
9427
*
9428
* def init_table(self, int p):
9429
* assert p >= 7 and (p%5 == 2 or p%5 == 3) # inert prime >= 7 # <<<<<<<<<<<<<<
9430
* if self.tables.has_key(p):
9431
* return
9432
*/
9433
#ifndef CYTHON_WITHOUT_ASSERTIONS
9434
if (unlikely(!Py_OptimizeFlag)) {
9435
__pyx_t_2 = ((__pyx_v_p >= 7) != 0);
9436
if (__pyx_t_2) {
9437
} else {
9438
__pyx_t_1 = __pyx_t_2;
9439
goto __pyx_L3_bool_binop_done;
9440
}
9441
__pyx_t_2 = ((__Pyx_mod_long(__pyx_v_p, 5) == 2) != 0);
9442
if (!__pyx_t_2) {
9443
} else {
9444
__pyx_t_1 = __pyx_t_2;
9445
goto __pyx_L3_bool_binop_done;
9446
}
9447
__pyx_t_2 = ((__Pyx_mod_long(__pyx_v_p, 5) == 3) != 0);
9448
__pyx_t_1 = __pyx_t_2;
9449
__pyx_L3_bool_binop_done:;
9450
if (unlikely(!__pyx_t_1)) {
9451
PyErr_SetNone(PyExc_AssertionError);
9452
__PYX_ERR(0, 398, __pyx_L1_error)
9453
}
9454
}
9455
#endif
9456
9457
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":399
9458
* def init_table(self, int p):
9459
* assert p >= 7 and (p%5 == 2 or p%5 == 3) # inert prime >= 7
9460
* if self.tables.has_key(p): # <<<<<<<<<<<<<<
9461
* return
9462
* # create the table for the given prime p.
9463
*/
9464
if (unlikely(__pyx_v_self->tables == Py_None)) {
9465
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "has_key");
9466
__PYX_ERR(0, 399, __pyx_L1_error)
9467
}
9468
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
9469
__Pyx_GOTREF(__pyx_t_3);
9470
__pyx_t_1 = PyDict_Contains(__pyx_v_self->tables, __pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 399, __pyx_L1_error)
9471
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9472
__pyx_t_2 = (__pyx_t_1 != 0);
9473
if (__pyx_t_2) {
9474
9475
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":400
9476
* assert p >= 7 and (p%5 == 2 or p%5 == 3) # inert prime >= 7
9477
* if self.tables.has_key(p):
9478
* return # <<<<<<<<<<<<<<
9479
* # create the table for the given prime p.
9480
* from psage.modform.hilbert.sqrt5.sqrt5 import F
9481
*/
9482
__Pyx_XDECREF(__pyx_r);
9483
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
9484
goto __pyx_L0;
9485
9486
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":399
9487
* def init_table(self, int p):
9488
* assert p >= 7 and (p%5 == 2 or p%5 == 3) # inert prime >= 7
9489
* if self.tables.has_key(p): # <<<<<<<<<<<<<<
9490
* return
9491
* # create the table for the given prime p.
9492
*/
9493
}
9494
9495
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":402
9496
* return
9497
* # create the table for the given prime p.
9498
* from psage.modform.hilbert.sqrt5.sqrt5 import F # <<<<<<<<<<<<<<
9499
* cdef ResidueRing_abstract R = ResidueRing(F.ideal(p), 1)
9500
*
9501
*/
9502
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
9503
__Pyx_GOTREF(__pyx_t_3);
9504
__Pyx_INCREF(__pyx_n_s_F);
9505
__Pyx_GIVEREF(__pyx_n_s_F);
9506
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_F);
9507
__pyx_t_4 = __Pyx_Import(__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error)
9508
__Pyx_GOTREF(__pyx_t_4);
9509
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9510
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_F); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 402, __pyx_L1_error)
9511
__Pyx_GOTREF(__pyx_t_3);
9512
__Pyx_INCREF(__pyx_t_3);
9513
__pyx_v_F = __pyx_t_3;
9514
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9515
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9516
9517
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":403
9518
* # create the table for the given prime p.
9519
* from psage.modform.hilbert.sqrt5.sqrt5 import F
9520
* cdef ResidueRing_abstract R = ResidueRing(F.ideal(p), 1) # <<<<<<<<<<<<<<
9521
*
9522
* cdef IntList ap, c_quo
9523
*/
9524
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ResidueRing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 403, __pyx_L1_error)
9525
__Pyx_GOTREF(__pyx_t_3);
9526
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_F, __pyx_n_s_ideal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 403, __pyx_L1_error)
9527
__Pyx_GOTREF(__pyx_t_6);
9528
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_p); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 403, __pyx_L1_error)
9529
__Pyx_GOTREF(__pyx_t_7);
9530
__pyx_t_8 = NULL;
9531
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9532
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
9533
if (likely(__pyx_t_8)) {
9534
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9535
__Pyx_INCREF(__pyx_t_8);
9536
__Pyx_INCREF(function);
9537
__Pyx_DECREF_SET(__pyx_t_6, function);
9538
}
9539
}
9540
if (!__pyx_t_8) {
9541
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error)
9542
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9543
__Pyx_GOTREF(__pyx_t_5);
9544
} else {
9545
#if CYTHON_FAST_PYCALL
9546
if (PyFunction_Check(__pyx_t_6)) {
9547
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7};
9548
__pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error)
9549
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9550
__Pyx_GOTREF(__pyx_t_5);
9551
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9552
} else
9553
#endif
9554
#if CYTHON_FAST_PYCCALL
9555
if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9556
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7};
9557
__pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error)
9558
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9559
__Pyx_GOTREF(__pyx_t_5);
9560
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9561
} else
9562
#endif
9563
{
9564
__pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 403, __pyx_L1_error)
9565
__Pyx_GOTREF(__pyx_t_9);
9566
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
9567
__Pyx_GIVEREF(__pyx_t_7);
9568
PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_7);
9569
__pyx_t_7 = 0;
9570
__pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error)
9571
__Pyx_GOTREF(__pyx_t_5);
9572
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9573
}
9574
}
9575
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9576
__pyx_t_6 = NULL;
9577
__pyx_t_10 = 0;
9578
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9579
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
9580
if (likely(__pyx_t_6)) {
9581
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9582
__Pyx_INCREF(__pyx_t_6);
9583
__Pyx_INCREF(function);
9584
__Pyx_DECREF_SET(__pyx_t_3, function);
9585
__pyx_t_10 = 1;
9586
}
9587
}
9588
#if CYTHON_FAST_PYCALL
9589
if (PyFunction_Check(__pyx_t_3)) {
9590
PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_1};
9591
__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, 403, __pyx_L1_error)
9592
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9593
__Pyx_GOTREF(__pyx_t_4);
9594
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9595
} else
9596
#endif
9597
#if CYTHON_FAST_PYCCALL
9598
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
9599
PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_int_1};
9600
__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, 403, __pyx_L1_error)
9601
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9602
__Pyx_GOTREF(__pyx_t_4);
9603
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9604
} else
9605
#endif
9606
{
9607
__pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 403, __pyx_L1_error)
9608
__Pyx_GOTREF(__pyx_t_9);
9609
if (__pyx_t_6) {
9610
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
9611
}
9612
__Pyx_GIVEREF(__pyx_t_5);
9613
PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_5);
9614
__Pyx_INCREF(__pyx_int_1);
9615
__Pyx_GIVEREF(__pyx_int_1);
9616
PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_int_1);
9617
__pyx_t_5 = 0;
9618
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error)
9619
__Pyx_GOTREF(__pyx_t_4);
9620
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
9621
}
9622
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9623
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, 403, __pyx_L1_error)
9624
__pyx_v_R = ((struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *)__pyx_t_4);
9625
__pyx_t_4 = 0;
9626
9627
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":406
9628
*
9629
* cdef IntList ap, c_quo
9630
* ap = IntList(R.cardinality()) # <<<<<<<<<<<<<<
9631
* c_quo = IntList(R.cardinality())
9632
* squares = IntList(R.cardinality())
9633
*/
9634
__pyx_t_4 = __Pyx_PyInt_From_long(((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)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 406, __pyx_L1_error)
9635
__Pyx_GOTREF(__pyx_t_4);
9636
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error)
9637
__Pyx_GOTREF(__pyx_t_3);
9638
__Pyx_GIVEREF(__pyx_t_4);
9639
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9640
__pyx_t_4 = 0;
9641
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5stats_7intlist_IntList), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 406, __pyx_L1_error)
9642
__Pyx_GOTREF(__pyx_t_4);
9643
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9644
__pyx_v_ap = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_4);
9645
__pyx_t_4 = 0;
9646
9647
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":407
9648
* cdef IntList ap, c_quo
9649
* ap = IntList(R.cardinality())
9650
* c_quo = IntList(R.cardinality()) # <<<<<<<<<<<<<<
9651
* squares = IntList(R.cardinality())
9652
* self.tables[p] = {'R':R, 'ap':ap, 'c_quo':c_quo, 'squares':squares}
9653
*/
9654
__pyx_t_4 = __Pyx_PyInt_From_long(((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)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error)
9655
__Pyx_GOTREF(__pyx_t_4);
9656
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error)
9657
__Pyx_GOTREF(__pyx_t_3);
9658
__Pyx_GIVEREF(__pyx_t_4);
9659
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9660
__pyx_t_4 = 0;
9661
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5stats_7intlist_IntList), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error)
9662
__Pyx_GOTREF(__pyx_t_4);
9663
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9664
__pyx_v_c_quo = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_4);
9665
__pyx_t_4 = 0;
9666
9667
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":408
9668
* ap = IntList(R.cardinality())
9669
* c_quo = IntList(R.cardinality())
9670
* squares = IntList(R.cardinality()) # <<<<<<<<<<<<<<
9671
* self.tables[p] = {'R':R, 'ap':ap, 'c_quo':c_quo, 'squares':squares}
9672
*
9673
*/
9674
__pyx_t_4 = __Pyx_PyInt_From_long(((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)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
9675
__Pyx_GOTREF(__pyx_t_4);
9676
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
9677
__Pyx_GOTREF(__pyx_t_3);
9678
__Pyx_GIVEREF(__pyx_t_4);
9679
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9680
__pyx_t_4 = 0;
9681
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5stats_7intlist_IntList), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
9682
__Pyx_GOTREF(__pyx_t_4);
9683
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9684
__pyx_v_squares = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_4);
9685
__pyx_t_4 = 0;
9686
9687
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":409
9688
* c_quo = IntList(R.cardinality())
9689
* squares = IntList(R.cardinality())
9690
* self.tables[p] = {'R':R, 'ap':ap, 'c_quo':c_quo, 'squares':squares} # <<<<<<<<<<<<<<
9691
*
9692
* self.init_squares_table(squares, R)
9693
*/
9694
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L1_error)
9695
__Pyx_GOTREF(__pyx_t_4);
9696
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_R, ((PyObject *)__pyx_v_R)) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
9697
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ap, ((PyObject *)__pyx_v_ap)) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
9698
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_c_quo, ((PyObject *)__pyx_v_c_quo)) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
9699
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_squares, ((PyObject *)__pyx_v_squares)) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
9700
if (unlikely(__pyx_v_self->tables == Py_None)) {
9701
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9702
__PYX_ERR(0, 409, __pyx_L1_error)
9703
}
9704
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
9705
__Pyx_GOTREF(__pyx_t_3);
9706
if (unlikely(PyDict_SetItem(__pyx_v_self->tables, __pyx_t_3, __pyx_t_4) < 0)) __PYX_ERR(0, 409, __pyx_L1_error)
9707
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9708
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9709
9710
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":411
9711
* self.tables[p] = {'R':R, 'ap':ap, 'c_quo':c_quo, 'squares':squares}
9712
*
9713
* self.init_squares_table(squares, R) # <<<<<<<<<<<<<<
9714
*
9715
* cdef IntList cubes = IntList(R.cardinality())
9716
*/
9717
__pyx_t_10 = ((struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self->__pyx_vtab)->init_squares_table(__pyx_v_self, __pyx_v_squares, __pyx_v_R); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 411, __pyx_L1_error)
9718
9719
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":413
9720
* self.init_squares_table(squares, R)
9721
*
9722
* cdef IntList cubes = IntList(R.cardinality()) # <<<<<<<<<<<<<<
9723
* self.cube_table(cubes, R)
9724
*
9725
*/
9726
__pyx_t_4 = __Pyx_PyInt_From_long(((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)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
9727
__Pyx_GOTREF(__pyx_t_4);
9728
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
9729
__Pyx_GOTREF(__pyx_t_3);
9730
__Pyx_GIVEREF(__pyx_t_4);
9731
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9732
__pyx_t_4 = 0;
9733
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_5stats_7intlist_IntList), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
9734
__Pyx_GOTREF(__pyx_t_4);
9735
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9736
__pyx_v_cubes = ((struct __pyx_obj_4sage_5stats_7intlist_IntList *)__pyx_t_4);
9737
__pyx_t_4 = 0;
9738
9739
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":414
9740
*
9741
* cdef IntList cubes = IntList(R.cardinality())
9742
* self.cube_table(cubes, R) # <<<<<<<<<<<<<<
9743
*
9744
* cdef long i
9745
*/
9746
__pyx_t_10 = ((struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self->__pyx_vtab)->cube_table(__pyx_v_self, __pyx_v_cubes, __pyx_v_R); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 414, __pyx_L1_error)
9747
9748
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":418
9749
* cdef long i
9750
* cdef residue_element j, a4, a6
9751
* sig_on() # <<<<<<<<<<<<<<
9752
* for i in range(R.cardinality()):
9753
* R.unsafe_ith_element(j, i)
9754
*/
9755
__pyx_t_10 = sig_on(); if (unlikely(__pyx_t_10 == 0)) __PYX_ERR(0, 418, __pyx_L1_error)
9756
9757
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":419
9758
* cdef residue_element j, a4, a6
9759
* sig_on()
9760
* for i in range(R.cardinality()): # <<<<<<<<<<<<<<
9761
* R.unsafe_ith_element(j, i)
9762
* self.elliptic_curve_from_j(a4, a6, j, R)
9763
*/
9764
__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);
9765
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9766
__pyx_v_i = __pyx_t_12;
9767
9768
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":420
9769
* sig_on()
9770
* for i in range(R.cardinality()):
9771
* R.unsafe_ith_element(j, i) # <<<<<<<<<<<<<<
9772
* self.elliptic_curve_from_j(a4, a6, j, R)
9773
* self.ap_via_enumeration(&ap._values[i], &c_quo._values[i], a4, a6, R, squares, cubes)
9774
*/
9775
((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_j, __pyx_v_i);
9776
9777
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":421
9778
* for i in range(R.cardinality()):
9779
* R.unsafe_ith_element(j, i)
9780
* self.elliptic_curve_from_j(a4, a6, j, R) # <<<<<<<<<<<<<<
9781
* self.ap_via_enumeration(&ap._values[i], &c_quo._values[i], a4, a6, R, squares, cubes)
9782
* sig_off()
9783
*/
9784
__pyx_t_10 = ((struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self->__pyx_vtab)->elliptic_curve_from_j(__pyx_v_self, __pyx_v_a4, __pyx_v_a6, __pyx_v_j, __pyx_v_R); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 421, __pyx_L1_error)
9785
9786
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":422
9787
* R.unsafe_ith_element(j, i)
9788
* self.elliptic_curve_from_j(a4, a6, j, R)
9789
* self.ap_via_enumeration(&ap._values[i], &c_quo._values[i], a4, a6, R, squares, cubes) # <<<<<<<<<<<<<<
9790
* sig_off()
9791
*
9792
*/
9793
__pyx_t_10 = ((struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self->__pyx_vtab)->ap_via_enumeration(__pyx_v_self, (&(__pyx_v_ap->_values[__pyx_v_i])), (&(__pyx_v_c_quo->_values[__pyx_v_i])), __pyx_v_a4, __pyx_v_a6, __pyx_v_R, __pyx_v_squares, __pyx_v_cubes); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 422, __pyx_L1_error)
9794
}
9795
9796
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":423
9797
* self.elliptic_curve_from_j(a4, a6, j, R)
9798
* self.ap_via_enumeration(&ap._values[i], &c_quo._values[i], a4, a6, R, squares, cubes)
9799
* sig_off() # <<<<<<<<<<<<<<
9800
*
9801
* cdef int cube_table(self, IntList cubes, ResidueRing_abstract R) except -1:
9802
*/
9803
sig_off();
9804
9805
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":397
9806
*
9807
*
9808
* def init_table(self, int p): # <<<<<<<<<<<<<<
9809
* assert p >= 7 and (p%5 == 2 or p%5 == 3) # inert prime >= 7
9810
* if self.tables.has_key(p):
9811
*/
9812
9813
/* function exit code */
9814
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
9815
goto __pyx_L0;
9816
__pyx_L1_error:;
9817
__Pyx_XDECREF(__pyx_t_3);
9818
__Pyx_XDECREF(__pyx_t_4);
9819
__Pyx_XDECREF(__pyx_t_5);
9820
__Pyx_XDECREF(__pyx_t_6);
9821
__Pyx_XDECREF(__pyx_t_7);
9822
__Pyx_XDECREF(__pyx_t_8);
9823
__Pyx_XDECREF(__pyx_t_9);
9824
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.init_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
9825
__pyx_r = NULL;
9826
__pyx_L0:;
9827
__Pyx_XDECREF(__pyx_v_F);
9828
__Pyx_XDECREF((PyObject *)__pyx_v_R);
9829
__Pyx_XDECREF((PyObject *)__pyx_v_ap);
9830
__Pyx_XDECREF((PyObject *)__pyx_v_c_quo);
9831
__Pyx_XDECREF((PyObject *)__pyx_v_squares);
9832
__Pyx_XDECREF((PyObject *)__pyx_v_cubes);
9833
__Pyx_XGIVEREF(__pyx_r);
9834
__Pyx_RefNannyFinishContext();
9835
return __pyx_r;
9836
}
9837
9838
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":425
9839
* sig_off()
9840
*
9841
* cdef int cube_table(self, IntList cubes, ResidueRing_abstract R) except -1: # <<<<<<<<<<<<<<
9842
* cdef long i
9843
* cdef residue_element x, y
9844
*/
9845
9846
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_cube_table(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_cubes, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R) {
9847
long __pyx_v_i;
9848
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_x;
9849
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_y;
9850
int __pyx_r;
9851
__Pyx_RefNannyDeclarations
9852
long __pyx_t_1;
9853
long __pyx_t_2;
9854
long __pyx_t_3;
9855
__Pyx_RefNannySetupContext("cube_table", 0);
9856
9857
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":428
9858
* cdef long i
9859
* cdef residue_element x, y
9860
* for i in range(R.cardinality()): # <<<<<<<<<<<<<<
9861
* R.unsafe_ith_element(x, i)
9862
* R.mul(y, x, x) # y = x^2
9863
*/
9864
__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)->cardinality(__pyx_v_R, 0);
9865
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
9866
__pyx_v_i = __pyx_t_2;
9867
9868
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":429
9869
* cdef residue_element x, y
9870
* for i in range(R.cardinality()):
9871
* R.unsafe_ith_element(x, i) # <<<<<<<<<<<<<<
9872
* R.mul(y, x, x) # y = x^2
9873
* R.mul(y, y, x) # y = x^3
9874
*/
9875
((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);
9876
9877
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":430
9878
* for i in range(R.cardinality()):
9879
* R.unsafe_ith_element(x, i)
9880
* R.mul(y, x, x) # y = x^2 # <<<<<<<<<<<<<<
9881
* R.mul(y, y, x) # y = x^3
9882
* cubes._values[i] = R.index_of_element(y)
9883
*/
9884
((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_y, __pyx_v_x, __pyx_v_x);
9885
9886
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":431
9887
* R.unsafe_ith_element(x, i)
9888
* R.mul(y, x, x) # y = x^2
9889
* R.mul(y, y, x) # y = x^3 # <<<<<<<<<<<<<<
9890
* cubes._values[i] = R.index_of_element(y)
9891
* return 0
9892
*/
9893
((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_y, __pyx_v_y, __pyx_v_x);
9894
9895
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":432
9896
* R.mul(y, x, x) # y = x^2
9897
* R.mul(y, y, x) # y = x^3
9898
* cubes._values[i] = R.index_of_element(y) # <<<<<<<<<<<<<<
9899
* return 0
9900
*
9901
*/
9902
__pyx_t_3 = ((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)->index_of_element(__pyx_v_R, __pyx_v_y); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(0, 432, __pyx_L1_error)
9903
(__pyx_v_cubes->_values[__pyx_v_i]) = __pyx_t_3;
9904
}
9905
9906
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":433
9907
* R.mul(y, y, x) # y = x^3
9908
* cubes._values[i] = R.index_of_element(y)
9909
* return 0 # <<<<<<<<<<<<<<
9910
*
9911
* cdef int init_squares_table(self, IntList squares,
9912
*/
9913
__pyx_r = 0;
9914
goto __pyx_L0;
9915
9916
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":425
9917
* sig_off()
9918
*
9919
* cdef int cube_table(self, IntList cubes, ResidueRing_abstract R) except -1: # <<<<<<<<<<<<<<
9920
* cdef long i
9921
* cdef residue_element x, y
9922
*/
9923
9924
/* function exit code */
9925
__pyx_L1_error:;
9926
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.cube_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
9927
__pyx_r = -1;
9928
__pyx_L0:;
9929
__Pyx_RefNannyFinishContext();
9930
return __pyx_r;
9931
}
9932
9933
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":435
9934
* return 0
9935
*
9936
* cdef int init_squares_table(self, IntList squares, # <<<<<<<<<<<<<<
9937
* ResidueRing_abstract R) except -1:
9938
*
9939
*/
9940
9941
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_init_squares_table(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_squares, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R) {
9942
long __pyx_v_i;
9943
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_x;
9944
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_y;
9945
int __pyx_r;
9946
__Pyx_RefNannyDeclarations
9947
long __pyx_t_1;
9948
long __pyx_t_2;
9949
long __pyx_t_3;
9950
__Pyx_RefNannySetupContext("init_squares_table", 0);
9951
9952
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":440
9953
* cdef long i
9954
* cdef residue_element x, y
9955
* for i in range(R.cardinality()): # <<<<<<<<<<<<<<
9956
* R.unsafe_ith_element(x, i)
9957
* R.mul(y, x, x)
9958
*/
9959
__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)->cardinality(__pyx_v_R, 0);
9960
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
9961
__pyx_v_i = __pyx_t_2;
9962
9963
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":441
9964
* cdef residue_element x, y
9965
* for i in range(R.cardinality()):
9966
* R.unsafe_ith_element(x, i) # <<<<<<<<<<<<<<
9967
* R.mul(y, x, x)
9968
* squares._values[R.index_of_element(y)] = 1
9969
*/
9970
((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);
9971
9972
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":442
9973
* for i in range(R.cardinality()):
9974
* R.unsafe_ith_element(x, i)
9975
* R.mul(y, x, x) # <<<<<<<<<<<<<<
9976
* squares._values[R.index_of_element(y)] = 1
9977
* return 0
9978
*/
9979
((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_y, __pyx_v_x, __pyx_v_x);
9980
9981
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":443
9982
* R.unsafe_ith_element(x, i)
9983
* R.mul(y, x, x)
9984
* squares._values[R.index_of_element(y)] = 1 # <<<<<<<<<<<<<<
9985
* return 0
9986
*
9987
*/
9988
__pyx_t_3 = ((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)->index_of_element(__pyx_v_R, __pyx_v_y); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(0, 443, __pyx_L1_error)
9989
(__pyx_v_squares->_values[__pyx_t_3]) = 1;
9990
}
9991
9992
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":444
9993
* R.mul(y, x, x)
9994
* squares._values[R.index_of_element(y)] = 1
9995
* return 0 # <<<<<<<<<<<<<<
9996
*
9997
* cdef int elliptic_curve_from_j(self,
9998
*/
9999
__pyx_r = 0;
10000
goto __pyx_L0;
10001
10002
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":435
10003
* return 0
10004
*
10005
* cdef int init_squares_table(self, IntList squares, # <<<<<<<<<<<<<<
10006
* ResidueRing_abstract R) except -1:
10007
*
10008
*/
10009
10010
/* function exit code */
10011
__pyx_L1_error:;
10012
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.init_squares_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
10013
__pyx_r = -1;
10014
__pyx_L0:;
10015
__Pyx_RefNannyFinishContext();
10016
return __pyx_r;
10017
}
10018
10019
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":446
10020
* return 0
10021
*
10022
* cdef int elliptic_curve_from_j(self, # <<<<<<<<<<<<<<
10023
* residue_element a4,
10024
* residue_element a6,
10025
*/
10026
10027
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_elliptic_curve_from_j(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, long *__pyx_v_a4, long *__pyx_v_a6, long *__pyx_v_j, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R) {
10028
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_k;
10029
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_m_three;
10030
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_m_two;
10031
int __pyx_r;
10032
__Pyx_RefNannyDeclarations
10033
int __pyx_t_1;
10034
__Pyx_RefNannySetupContext("elliptic_curve_from_j", 0);
10035
10036
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":454
10037
*
10038
* # k = 1728
10039
* k[0] = 1728 % R.p; k[1] = 0 # <<<<<<<<<<<<<<
10040
*
10041
* if R.element_is_0(j): # if j==0
10042
*/
10043
if (unlikely(__pyx_v_R->p == 0)) {
10044
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
10045
__PYX_ERR(0, 454, __pyx_L1_error)
10046
}
10047
(__pyx_v_k[0]) = __Pyx_mod_long(0x6C0, __pyx_v_R->p);
10048
(__pyx_v_k[1]) = 0;
10049
10050
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":456
10051
* k[0] = 1728 % R.p; k[1] = 0
10052
*
10053
* if R.element_is_0(j): # if j==0 # <<<<<<<<<<<<<<
10054
* R.set_element_to_0(a4)
10055
* R.set_element_to_1(a6)
10056
*/
10057
__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_j) != 0);
10058
if (__pyx_t_1) {
10059
10060
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":457
10061
*
10062
* if R.element_is_0(j): # if j==0
10063
* R.set_element_to_0(a4) # <<<<<<<<<<<<<<
10064
* R.set_element_to_1(a6)
10065
* return 0
10066
*/
10067
((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)->set_element_to_0(__pyx_v_R, __pyx_v_a4);
10068
10069
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":458
10070
* if R.element_is_0(j): # if j==0
10071
* R.set_element_to_0(a4)
10072
* R.set_element_to_1(a6) # <<<<<<<<<<<<<<
10073
* return 0
10074
*
10075
*/
10076
((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)->set_element_to_1(__pyx_v_R, __pyx_v_a6);
10077
10078
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":459
10079
* R.set_element_to_0(a4)
10080
* R.set_element_to_1(a6)
10081
* return 0 # <<<<<<<<<<<<<<
10082
*
10083
* if R.cmp_element(j, k) == 0: # if j==1728
10084
*/
10085
__pyx_r = 0;
10086
goto __pyx_L0;
10087
10088
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":456
10089
* k[0] = 1728 % R.p; k[1] = 0
10090
*
10091
* if R.element_is_0(j): # if j==0 # <<<<<<<<<<<<<<
10092
* R.set_element_to_0(a4)
10093
* R.set_element_to_1(a6)
10094
*/
10095
}
10096
10097
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":461
10098
* return 0
10099
*
10100
* if R.cmp_element(j, k) == 0: # if j==1728 # <<<<<<<<<<<<<<
10101
* R.set_element_to_1(a4)
10102
* R.set_element_to_0(a6)
10103
*/
10104
__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)->cmp_element(__pyx_v_R, __pyx_v_j, __pyx_v_k) == 0) != 0);
10105
if (__pyx_t_1) {
10106
10107
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":462
10108
*
10109
* if R.cmp_element(j, k) == 0: # if j==1728
10110
* R.set_element_to_1(a4) # <<<<<<<<<<<<<<
10111
* R.set_element_to_0(a6)
10112
* return 0
10113
*/
10114
((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)->set_element_to_1(__pyx_v_R, __pyx_v_a4);
10115
10116
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":463
10117
* if R.cmp_element(j, k) == 0: # if j==1728
10118
* R.set_element_to_1(a4)
10119
* R.set_element_to_0(a6) # <<<<<<<<<<<<<<
10120
* return 0
10121
*
10122
*/
10123
((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)->set_element_to_0(__pyx_v_R, __pyx_v_a6);
10124
10125
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":464
10126
* R.set_element_to_1(a4)
10127
* R.set_element_to_0(a6)
10128
* return 0 # <<<<<<<<<<<<<<
10129
*
10130
* # -3 and -2
10131
*/
10132
__pyx_r = 0;
10133
goto __pyx_L0;
10134
10135
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":461
10136
* return 0
10137
*
10138
* if R.cmp_element(j, k) == 0: # if j==1728 # <<<<<<<<<<<<<<
10139
* R.set_element_to_1(a4)
10140
* R.set_element_to_0(a6)
10141
*/
10142
}
10143
10144
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":467
10145
*
10146
* # -3 and -2
10147
* m_three[0] = R.p - 3; m_three[1] = 0 # <<<<<<<<<<<<<<
10148
* m_two[0] = R.p - 2; m_two[1] = 0
10149
*
10150
*/
10151
(__pyx_v_m_three[0]) = (__pyx_v_R->p - 3);
10152
(__pyx_v_m_three[1]) = 0;
10153
10154
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":468
10155
* # -3 and -2
10156
* m_three[0] = R.p - 3; m_three[1] = 0
10157
* m_two[0] = R.p - 2; m_two[1] = 0 # <<<<<<<<<<<<<<
10158
*
10159
* # k = j-1728
10160
*/
10161
(__pyx_v_m_two[0]) = (__pyx_v_R->p - 2);
10162
(__pyx_v_m_two[1]) = 0;
10163
10164
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":471
10165
*
10166
* # k = j-1728
10167
* R.sub(k, j, k) # <<<<<<<<<<<<<<
10168
*
10169
* # a4 = -3*j*k
10170
*/
10171
((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)->sub(__pyx_v_R, __pyx_v_k, __pyx_v_j, __pyx_v_k);
10172
10173
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":474
10174
*
10175
* # a4 = -3*j*k
10176
* R.mul(a4, m_three, j) # <<<<<<<<<<<<<<
10177
* R.mul(a4, a4, k)
10178
*
10179
*/
10180
((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_a4, __pyx_v_m_three, __pyx_v_j);
10181
10182
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":475
10183
* # a4 = -3*j*k
10184
* R.mul(a4, m_three, j)
10185
* R.mul(a4, a4, k) # <<<<<<<<<<<<<<
10186
*
10187
* # a6 = -2*j*k^2
10188
*/
10189
((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_a4, __pyx_v_a4, __pyx_v_k);
10190
10191
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":478
10192
*
10193
* # a6 = -2*j*k^2
10194
* R.mul(a6, m_two, j) # <<<<<<<<<<<<<<
10195
* R.mul(a6, a6, k)
10196
* R.mul(a6, a6, k)
10197
*/
10198
((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_a6, __pyx_v_m_two, __pyx_v_j);
10199
10200
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":479
10201
* # a6 = -2*j*k^2
10202
* R.mul(a6, m_two, j)
10203
* R.mul(a6, a6, k) # <<<<<<<<<<<<<<
10204
* R.mul(a6, a6, k)
10205
*
10206
*/
10207
((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_a6, __pyx_v_a6, __pyx_v_k);
10208
10209
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":480
10210
* R.mul(a6, m_two, j)
10211
* R.mul(a6, a6, k)
10212
* R.mul(a6, a6, k) # <<<<<<<<<<<<<<
10213
*
10214
*
10215
*/
10216
((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_a6, __pyx_v_a6, __pyx_v_k);
10217
10218
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":446
10219
* return 0
10220
*
10221
* cdef int elliptic_curve_from_j(self, # <<<<<<<<<<<<<<
10222
* residue_element a4,
10223
* residue_element a6,
10224
*/
10225
10226
/* function exit code */
10227
__pyx_r = 0;
10228
goto __pyx_L0;
10229
__pyx_L1_error:;
10230
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.elliptic_curve_from_j", __pyx_clineno, __pyx_lineno, __pyx_filename);
10231
__pyx_r = -1;
10232
__pyx_L0:;
10233
__Pyx_RefNannyFinishContext();
10234
return __pyx_r;
10235
}
10236
10237
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":483
10238
*
10239
*
10240
* cdef int ap_via_enumeration(self, int* ap, int* c_quo, # <<<<<<<<<<<<<<
10241
* residue_element a4, residue_element a6,
10242
* ResidueRing_abstract R,
10243
*/
10244
10245
static int __pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_ap_via_enumeration(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, int *__pyx_v_ap, int *__pyx_v_c_quo, long *__pyx_v_a4, long *__pyx_v_a6, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *__pyx_v_R, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_squares, struct __pyx_obj_4sage_5stats_7intlist_IntList *__pyx_v_cubes) {
10246
long __pyx_v_i;
10247
long __pyx_v_cnt;
10248
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_x;
10249
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_z;
10250
__pyx_t_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_residue_element __pyx_v_w;
10251
int __pyx_r;
10252
__Pyx_RefNannyDeclarations
10253
long __pyx_t_1;
10254
long __pyx_t_2;
10255
int __pyx_t_3;
10256
long __pyx_t_4;
10257
int __pyx_t_5;
10258
__Pyx_RefNannySetupContext("ap_via_enumeration", 0);
10259
10260
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":488
10261
* IntList squares,
10262
* IntList cubes) except -1:
10263
* assert R.p >= 7 # <<<<<<<<<<<<<<
10264
* cdef long i, j, cnt = 1 # start 1 because of point at infinity
10265
* cdef residue_element x, z, w
10266
*/
10267
#ifndef CYTHON_WITHOUT_ASSERTIONS
10268
if (unlikely(!Py_OptimizeFlag)) {
10269
if (unlikely(!((__pyx_v_R->p >= 7) != 0))) {
10270
PyErr_SetNone(PyExc_AssertionError);
10271
__PYX_ERR(0, 488, __pyx_L1_error)
10272
}
10273
}
10274
#endif
10275
10276
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":489
10277
* IntList cubes) except -1:
10278
* assert R.p >= 7
10279
* cdef long i, j, cnt = 1 # start 1 because of point at infinity # <<<<<<<<<<<<<<
10280
* cdef residue_element x, z, w
10281
* for i in range(R.cardinality()):
10282
*/
10283
__pyx_v_cnt = 1;
10284
10285
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":491
10286
* cdef long i, j, cnt = 1 # start 1 because of point at infinity
10287
* cdef residue_element x, z, w
10288
* for i in range(R.cardinality()): # <<<<<<<<<<<<<<
10289
* R.unsafe_ith_element(x, i)
10290
* R.unsafe_ith_element(z, cubes._values[i]) # z = x^3
10291
*/
10292
__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)->cardinality(__pyx_v_R, 0);
10293
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
10294
__pyx_v_i = __pyx_t_2;
10295
10296
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":492
10297
* cdef residue_element x, z, w
10298
* for i in range(R.cardinality()):
10299
* R.unsafe_ith_element(x, i) # <<<<<<<<<<<<<<
10300
* R.unsafe_ith_element(z, cubes._values[i]) # z = x^3
10301
* R.mul(w, a4, x) # w = a4*x
10302
*/
10303
((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);
10304
10305
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":493
10306
* for i in range(R.cardinality()):
10307
* R.unsafe_ith_element(x, i)
10308
* R.unsafe_ith_element(z, cubes._values[i]) # z = x^3 # <<<<<<<<<<<<<<
10309
* R.mul(w, a4, x) # w = a4*x
10310
* R.add(z, z, w) # z = z + w = x^3 + a4*x
10311
*/
10312
((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_z, (__pyx_v_cubes->_values[__pyx_v_i]));
10313
10314
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":494
10315
* R.unsafe_ith_element(x, i)
10316
* R.unsafe_ith_element(z, cubes._values[i]) # z = x^3
10317
* R.mul(w, a4, x) # w = a4*x # <<<<<<<<<<<<<<
10318
* R.add(z, z, w) # z = z + w = x^3 + a4*x
10319
* R.add(z, z, a6) # z = x^3 + a4*x + a6
10320
*/
10321
((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);
10322
10323
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":495
10324
* R.unsafe_ith_element(z, cubes._values[i]) # z = x^3
10325
* R.mul(w, a4, x) # w = a4*x
10326
* R.add(z, z, w) # z = z + w = x^3 + a4*x # <<<<<<<<<<<<<<
10327
* R.add(z, z, a6) # z = x^3 + a4*x + a6
10328
* if R.element_is_0(z):
10329
*/
10330
((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);
10331
10332
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":496
10333
* R.mul(w, a4, x) # w = a4*x
10334
* R.add(z, z, w) # z = z + w = x^3 + a4*x
10335
* R.add(z, z, a6) # z = x^3 + a4*x + a6 # <<<<<<<<<<<<<<
10336
* if R.element_is_0(z):
10337
* cnt += 1
10338
*/
10339
((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);
10340
10341
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":497
10342
* R.add(z, z, w) # z = z + w = x^3 + a4*x
10343
* R.add(z, z, a6) # z = x^3 + a4*x + a6
10344
* if R.element_is_0(z): # <<<<<<<<<<<<<<
10345
* cnt += 1
10346
* else:
10347
*/
10348
__pyx_t_3 = (((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);
10349
if (__pyx_t_3) {
10350
10351
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":498
10352
* R.add(z, z, a6) # z = x^3 + a4*x + a6
10353
* if R.element_is_0(z):
10354
* cnt += 1 # <<<<<<<<<<<<<<
10355
* else:
10356
* if squares._values[R.index_of_element(z)]: # assumes p!=2.
10357
*/
10358
__pyx_v_cnt = (__pyx_v_cnt + 1);
10359
10360
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":497
10361
* R.add(z, z, w) # z = z + w = x^3 + a4*x
10362
* R.add(z, z, a6) # z = x^3 + a4*x + a6
10363
* if R.element_is_0(z): # <<<<<<<<<<<<<<
10364
* cnt += 1
10365
* else:
10366
*/
10367
goto __pyx_L5;
10368
}
10369
10370
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":500
10371
* cnt += 1
10372
* else:
10373
* if squares._values[R.index_of_element(z)]: # assumes p!=2. # <<<<<<<<<<<<<<
10374
* cnt += 2
10375
*
10376
*/
10377
/*else*/ {
10378
__pyx_t_4 = ((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)->index_of_element(__pyx_v_R, __pyx_v_z); if (unlikely(__pyx_t_4 == -1L)) __PYX_ERR(0, 500, __pyx_L1_error)
10379
__pyx_t_3 = ((__pyx_v_squares->_values[__pyx_t_4]) != 0);
10380
if (__pyx_t_3) {
10381
10382
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":501
10383
* else:
10384
* if squares._values[R.index_of_element(z)]: # assumes p!=2.
10385
* cnt += 2 # <<<<<<<<<<<<<<
10386
*
10387
* ap[0] = R.cardinality() + 1 - cnt
10388
*/
10389
__pyx_v_cnt = (__pyx_v_cnt + 2);
10390
10391
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":500
10392
* cnt += 1
10393
* else:
10394
* if squares._values[R.index_of_element(z)]: # assumes p!=2. # <<<<<<<<<<<<<<
10395
* cnt += 2
10396
*
10397
*/
10398
}
10399
}
10400
__pyx_L5:;
10401
}
10402
10403
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":503
10404
* cnt += 2
10405
*
10406
* ap[0] = R.cardinality() + 1 - cnt # <<<<<<<<<<<<<<
10407
*
10408
* # Now compute c4/c6 = a4/(18*a6)
10409
*/
10410
(__pyx_v_ap[0]) = ((((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);
10411
10412
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":506
10413
*
10414
* # Now compute c4/c6 = a4/(18*a6)
10415
* if R.element_is_0(a6): # <<<<<<<<<<<<<<
10416
* c_quo[0] = -1 # signifies "infinity"
10417
* else:
10418
*/
10419
__pyx_t_3 = (((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_a6) != 0);
10420
if (__pyx_t_3) {
10421
10422
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":507
10423
* # Now compute c4/c6 = a4/(18*a6)
10424
* if R.element_is_0(a6):
10425
* c_quo[0] = -1 # signifies "infinity" # <<<<<<<<<<<<<<
10426
* else:
10427
* x[0] = 18 % R.p; x[1] = 0 # x = 18
10428
*/
10429
(__pyx_v_c_quo[0]) = -1;
10430
10431
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":506
10432
*
10433
* # Now compute c4/c6 = a4/(18*a6)
10434
* if R.element_is_0(a6): # <<<<<<<<<<<<<<
10435
* c_quo[0] = -1 # signifies "infinity"
10436
* else:
10437
*/
10438
goto __pyx_L7;
10439
}
10440
10441
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":509
10442
* c_quo[0] = -1 # signifies "infinity"
10443
* else:
10444
* x[0] = 18 % R.p; x[1] = 0 # x = 18 # <<<<<<<<<<<<<<
10445
* R.mul(z, x, a6) # z = 18*a6
10446
* R.inv(w, z) # w = 1/(18*a6)
10447
*/
10448
/*else*/ {
10449
if (unlikely(__pyx_v_R->p == 0)) {
10450
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
10451
__PYX_ERR(0, 509, __pyx_L1_error)
10452
}
10453
(__pyx_v_x[0]) = __Pyx_mod_long(18, __pyx_v_R->p);
10454
(__pyx_v_x[1]) = 0;
10455
10456
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":510
10457
* else:
10458
* x[0] = 18 % R.p; x[1] = 0 # x = 18
10459
* R.mul(z, x, a6) # z = 18*a6 # <<<<<<<<<<<<<<
10460
* R.inv(w, z) # w = 1/(18*a6)
10461
* R.mul(z, a4, w) # z = a4/(18*a6)
10462
*/
10463
((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_a6);
10464
10465
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":511
10466
* x[0] = 18 % R.p; x[1] = 0 # x = 18
10467
* R.mul(z, x, a6) # z = 18*a6
10468
* R.inv(w, z) # w = 1/(18*a6) # <<<<<<<<<<<<<<
10469
* R.mul(z, a4, w) # z = a4/(18*a6)
10470
* c_quo[0] = R.index_of_element(z)
10471
*/
10472
__pyx_t_5 = ((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)->inv(__pyx_v_R, __pyx_v_w, __pyx_v_z); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 511, __pyx_L1_error)
10473
10474
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":512
10475
* R.mul(z, x, a6) # z = 18*a6
10476
* R.inv(w, z) # w = 1/(18*a6)
10477
* R.mul(z, a4, w) # z = a4/(18*a6) # <<<<<<<<<<<<<<
10478
* c_quo[0] = R.index_of_element(z)
10479
* return 0 # no error occurred
10480
*/
10481
((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_a4, __pyx_v_w);
10482
10483
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":513
10484
* R.inv(w, z) # w = 1/(18*a6)
10485
* R.mul(z, a4, w) # z = a4/(18*a6)
10486
* c_quo[0] = R.index_of_element(z) # <<<<<<<<<<<<<<
10487
* return 0 # no error occurred
10488
*
10489
*/
10490
__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)->index_of_element(__pyx_v_R, __pyx_v_z); if (unlikely(__pyx_t_1 == -1L)) __PYX_ERR(0, 513, __pyx_L1_error)
10491
(__pyx_v_c_quo[0]) = __pyx_t_1;
10492
}
10493
__pyx_L7:;
10494
10495
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":514
10496
* R.mul(z, a4, w) # z = a4/(18*a6)
10497
* c_quo[0] = R.index_of_element(z)
10498
* return 0 # no error occurred # <<<<<<<<<<<<<<
10499
*
10500
*
10501
*/
10502
__pyx_r = 0;
10503
goto __pyx_L0;
10504
10505
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":483
10506
*
10507
*
10508
* cdef int ap_via_enumeration(self, int* ap, int* c_quo, # <<<<<<<<<<<<<<
10509
* residue_element a4, residue_element a6,
10510
* ResidueRing_abstract R,
10511
*/
10512
10513
/* function exit code */
10514
__pyx_L1_error:;
10515
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.ap_via_enumeration", __pyx_clineno, __pyx_lineno, __pyx_filename);
10516
__pyx_r = -1;
10517
__pyx_L0:;
10518
__Pyx_RefNannyFinishContext();
10519
return __pyx_r;
10520
}
10521
10522
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":366
10523
*
10524
* cdef class InertTraceCalculator:
10525
* cdef public dict tables # <<<<<<<<<<<<<<
10526
*
10527
* def __init__(self):
10528
*/
10529
10530
/* Python wrapper */
10531
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_1__get__(PyObject *__pyx_v_self); /*proto*/
10532
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_1__get__(PyObject *__pyx_v_self) {
10533
PyObject *__pyx_r = 0;
10534
__Pyx_RefNannyDeclarations
10535
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10536
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables___get__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self));
10537
10538
/* function exit code */
10539
__Pyx_RefNannyFinishContext();
10540
return __pyx_r;
10541
}
10542
10543
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables___get__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self) {
10544
PyObject *__pyx_r = NULL;
10545
__Pyx_RefNannyDeclarations
10546
__Pyx_RefNannySetupContext("__get__", 0);
10547
__Pyx_XDECREF(__pyx_r);
10548
__Pyx_INCREF(__pyx_v_self->tables);
10549
__pyx_r = __pyx_v_self->tables;
10550
goto __pyx_L0;
10551
10552
/* function exit code */
10553
__pyx_L0:;
10554
__Pyx_XGIVEREF(__pyx_r);
10555
__Pyx_RefNannyFinishContext();
10556
return __pyx_r;
10557
}
10558
10559
/* Python wrapper */
10560
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
10561
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
10562
int __pyx_r;
10563
__Pyx_RefNannyDeclarations
10564
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
10565
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_2__set__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self), ((PyObject *)__pyx_v_value));
10566
10567
/* function exit code */
10568
__Pyx_RefNannyFinishContext();
10569
return __pyx_r;
10570
}
10571
10572
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_2__set__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self, PyObject *__pyx_v_value) {
10573
int __pyx_r;
10574
__Pyx_RefNannyDeclarations
10575
PyObject *__pyx_t_1 = NULL;
10576
__Pyx_RefNannySetupContext("__set__", 0);
10577
if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 366, __pyx_L1_error)
10578
__pyx_t_1 = __pyx_v_value;
10579
__Pyx_INCREF(__pyx_t_1);
10580
__Pyx_GIVEREF(__pyx_t_1);
10581
__Pyx_GOTREF(__pyx_v_self->tables);
10582
__Pyx_DECREF(__pyx_v_self->tables);
10583
__pyx_v_self->tables = ((PyObject*)__pyx_t_1);
10584
__pyx_t_1 = 0;
10585
10586
/* function exit code */
10587
__pyx_r = 0;
10588
goto __pyx_L0;
10589
__pyx_L1_error:;
10590
__Pyx_XDECREF(__pyx_t_1);
10591
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator.tables.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10592
__pyx_r = -1;
10593
__pyx_L0:;
10594
__Pyx_RefNannyFinishContext();
10595
return __pyx_r;
10596
}
10597
10598
/* Python wrapper */
10599
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_5__del__(PyObject *__pyx_v_self); /*proto*/
10600
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_5__del__(PyObject *__pyx_v_self) {
10601
int __pyx_r;
10602
__Pyx_RefNannyDeclarations
10603
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
10604
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_4__del__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)__pyx_v_self));
10605
10606
/* function exit code */
10607
__Pyx_RefNannyFinishContext();
10608
return __pyx_r;
10609
}
10610
10611
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_4__del__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *__pyx_v_self) {
10612
int __pyx_r;
10613
__Pyx_RefNannyDeclarations
10614
__Pyx_RefNannySetupContext("__del__", 0);
10615
__Pyx_INCREF(Py_None);
10616
__Pyx_GIVEREF(Py_None);
10617
__Pyx_GOTREF(__pyx_v_self->tables);
10618
__Pyx_DECREF(__pyx_v_self->tables);
10619
__pyx_v_self->tables = ((PyObject*)Py_None);
10620
10621
/* function exit code */
10622
__pyx_r = 0;
10623
__Pyx_RefNannyFinishContext();
10624
return __pyx_r;
10625
}
10626
10627
/* "sage/structure/parent.pxd":23
10628
* # Flags, see below
10629
* cdef int flags
10630
* cdef inline bint get_flag(self, int flag): # <<<<<<<<<<<<<<
10631
* return self.flags & flag
10632
*
10633
*/
10634
10635
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) {
10636
int __pyx_r;
10637
__Pyx_RefNannyDeclarations
10638
__Pyx_RefNannySetupContext("get_flag", 0);
10639
10640
/* "sage/structure/parent.pxd":24
10641
* cdef int flags
10642
* cdef inline bint get_flag(self, int flag):
10643
* return self.flags & flag # <<<<<<<<<<<<<<
10644
*
10645
* cpdef bint is_coercion_cached(self, domain)
10646
*/
10647
__pyx_r = (__pyx_v_self->flags & __pyx_v_flag);
10648
goto __pyx_L0;
10649
10650
/* "sage/structure/parent.pxd":23
10651
* # Flags, see below
10652
* cdef int flags
10653
* cdef inline bint get_flag(self, int flag): # <<<<<<<<<<<<<<
10654
* return self.flags & flag
10655
*
10656
*/
10657
10658
/* function exit code */
10659
__pyx_L0:;
10660
__Pyx_RefNannyFinishContext();
10661
return __pyx_r;
10662
}
10663
10664
/* "cysignals/memory.pxd":40
10665
*
10666
*
10667
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
10668
* sig_block()
10669
* cdef void* ret = malloc(n)
10670
*/
10671
10672
static CYTHON_INLINE void *sig_malloc(size_t __pyx_v_n) {
10673
void *__pyx_v_ret;
10674
void *__pyx_r;
10675
10676
/* "cysignals/memory.pxd":41
10677
*
10678
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
10679
* sig_block() # <<<<<<<<<<<<<<
10680
* cdef void* ret = malloc(n)
10681
* sig_unblock()
10682
*/
10683
sig_block();
10684
10685
/* "cysignals/memory.pxd":42
10686
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
10687
* sig_block()
10688
* cdef void* ret = malloc(n) # <<<<<<<<<<<<<<
10689
* sig_unblock()
10690
* return ret
10691
*/
10692
__pyx_v_ret = malloc(__pyx_v_n);
10693
10694
/* "cysignals/memory.pxd":43
10695
* sig_block()
10696
* cdef void* ret = malloc(n)
10697
* sig_unblock() # <<<<<<<<<<<<<<
10698
* return ret
10699
*
10700
*/
10701
sig_unblock();
10702
10703
/* "cysignals/memory.pxd":44
10704
* cdef void* ret = malloc(n)
10705
* sig_unblock()
10706
* return ret # <<<<<<<<<<<<<<
10707
*
10708
*
10709
*/
10710
__pyx_r = __pyx_v_ret;
10711
goto __pyx_L0;
10712
10713
/* "cysignals/memory.pxd":40
10714
*
10715
*
10716
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
10717
* sig_block()
10718
* cdef void* ret = malloc(n)
10719
*/
10720
10721
/* function exit code */
10722
__pyx_L0:;
10723
return __pyx_r;
10724
}
10725
10726
/* "cysignals/memory.pxd":47
10727
*
10728
*
10729
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
10730
* sig_block()
10731
* cdef void* ret = realloc(ptr, size)
10732
*/
10733
10734
static CYTHON_INLINE void *sig_realloc(void *__pyx_v_ptr, size_t __pyx_v_size) {
10735
void *__pyx_v_ret;
10736
void *__pyx_r;
10737
10738
/* "cysignals/memory.pxd":48
10739
*
10740
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
10741
* sig_block() # <<<<<<<<<<<<<<
10742
* cdef void* ret = realloc(ptr, size)
10743
* sig_unblock()
10744
*/
10745
sig_block();
10746
10747
/* "cysignals/memory.pxd":49
10748
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
10749
* sig_block()
10750
* cdef void* ret = realloc(ptr, size) # <<<<<<<<<<<<<<
10751
* sig_unblock()
10752
* return ret
10753
*/
10754
__pyx_v_ret = realloc(__pyx_v_ptr, __pyx_v_size);
10755
10756
/* "cysignals/memory.pxd":50
10757
* sig_block()
10758
* cdef void* ret = realloc(ptr, size)
10759
* sig_unblock() # <<<<<<<<<<<<<<
10760
* return ret
10761
*
10762
*/
10763
sig_unblock();
10764
10765
/* "cysignals/memory.pxd":51
10766
* cdef void* ret = realloc(ptr, size)
10767
* sig_unblock()
10768
* return ret # <<<<<<<<<<<<<<
10769
*
10770
*
10771
*/
10772
__pyx_r = __pyx_v_ret;
10773
goto __pyx_L0;
10774
10775
/* "cysignals/memory.pxd":47
10776
*
10777
*
10778
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
10779
* sig_block()
10780
* cdef void* ret = realloc(ptr, size)
10781
*/
10782
10783
/* function exit code */
10784
__pyx_L0:;
10785
return __pyx_r;
10786
}
10787
10788
/* "cysignals/memory.pxd":54
10789
*
10790
*
10791
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
10792
* sig_block()
10793
* cdef void* ret = calloc(nmemb, size)
10794
*/
10795
10796
static CYTHON_INLINE void *sig_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
10797
void *__pyx_v_ret;
10798
void *__pyx_r;
10799
10800
/* "cysignals/memory.pxd":55
10801
*
10802
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
10803
* sig_block() # <<<<<<<<<<<<<<
10804
* cdef void* ret = calloc(nmemb, size)
10805
* sig_unblock()
10806
*/
10807
sig_block();
10808
10809
/* "cysignals/memory.pxd":56
10810
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
10811
* sig_block()
10812
* cdef void* ret = calloc(nmemb, size) # <<<<<<<<<<<<<<
10813
* sig_unblock()
10814
* return ret
10815
*/
10816
__pyx_v_ret = calloc(__pyx_v_nmemb, __pyx_v_size);
10817
10818
/* "cysignals/memory.pxd":57
10819
* sig_block()
10820
* cdef void* ret = calloc(nmemb, size)
10821
* sig_unblock() # <<<<<<<<<<<<<<
10822
* return ret
10823
*
10824
*/
10825
sig_unblock();
10826
10827
/* "cysignals/memory.pxd":58
10828
* cdef void* ret = calloc(nmemb, size)
10829
* sig_unblock()
10830
* return ret # <<<<<<<<<<<<<<
10831
*
10832
*
10833
*/
10834
__pyx_r = __pyx_v_ret;
10835
goto __pyx_L0;
10836
10837
/* "cysignals/memory.pxd":54
10838
*
10839
*
10840
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
10841
* sig_block()
10842
* cdef void* ret = calloc(nmemb, size)
10843
*/
10844
10845
/* function exit code */
10846
__pyx_L0:;
10847
return __pyx_r;
10848
}
10849
10850
/* "cysignals/memory.pxd":61
10851
*
10852
*
10853
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
10854
* sig_block()
10855
* free(ptr)
10856
*/
10857
10858
static CYTHON_INLINE void sig_free(void *__pyx_v_ptr) {
10859
10860
/* "cysignals/memory.pxd":62
10861
*
10862
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
10863
* sig_block() # <<<<<<<<<<<<<<
10864
* free(ptr)
10865
* sig_unblock()
10866
*/
10867
sig_block();
10868
10869
/* "cysignals/memory.pxd":63
10870
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
10871
* sig_block()
10872
* free(ptr) # <<<<<<<<<<<<<<
10873
* sig_unblock()
10874
*
10875
*/
10876
free(__pyx_v_ptr);
10877
10878
/* "cysignals/memory.pxd":64
10879
* sig_block()
10880
* free(ptr)
10881
* sig_unblock() # <<<<<<<<<<<<<<
10882
*
10883
*
10884
*/
10885
sig_unblock();
10886
10887
/* "cysignals/memory.pxd":61
10888
*
10889
*
10890
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
10891
* sig_block()
10892
* free(ptr)
10893
*/
10894
10895
/* function exit code */
10896
}
10897
10898
/* "cysignals/memory.pxd":68
10899
*
10900
* @cython.cdivision(True)
10901
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
10902
* """
10903
* Return a*b, checking for overflow. Assume that a > 0.
10904
*/
10905
10906
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t __pyx_v_a, size_t __pyx_v_b) {
10907
size_t __pyx_v_MUL_NO_OVERFLOW;
10908
size_t __pyx_r;
10909
int __pyx_t_1;
10910
int __pyx_t_2;
10911
10912
/* "cysignals/memory.pxd":75
10913
* """
10914
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
10915
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t))) # <<<<<<<<<<<<<<
10916
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
10917
* if unlikely(b > (<size_t>-1) // a):
10918
*/
10919
__pyx_v_MUL_NO_OVERFLOW = (((size_t)1) << (4 * (sizeof(size_t))));
10920
10921
/* "cysignals/memory.pxd":76
10922
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
10923
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
10924
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
10925
* if unlikely(b > (<size_t>-1) // a):
10926
* return <size_t>(-1)
10927
*/
10928
__pyx_t_2 = ((__pyx_v_a >= __pyx_v_MUL_NO_OVERFLOW) != 0);
10929
if (!__pyx_t_2) {
10930
} else {
10931
__pyx_t_1 = __pyx_t_2;
10932
goto __pyx_L4_bool_binop_done;
10933
}
10934
__pyx_t_2 = ((__pyx_v_b >= __pyx_v_MUL_NO_OVERFLOW) != 0);
10935
__pyx_t_1 = __pyx_t_2;
10936
__pyx_L4_bool_binop_done:;
10937
if (__pyx_t_1) {
10938
10939
/* "cysignals/memory.pxd":77
10940
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
10941
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
10942
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
10943
* return <size_t>(-1)
10944
* return a*b
10945
*/
10946
__pyx_t_1 = (unlikely((__pyx_v_b > (((size_t)-1L) / __pyx_v_a))) != 0);
10947
if (__pyx_t_1) {
10948
10949
/* "cysignals/memory.pxd":78
10950
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
10951
* if unlikely(b > (<size_t>-1) // a):
10952
* return <size_t>(-1) # <<<<<<<<<<<<<<
10953
* return a*b
10954
*
10955
*/
10956
__pyx_r = ((size_t)-1L);
10957
goto __pyx_L0;
10958
10959
/* "cysignals/memory.pxd":77
10960
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
10961
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
10962
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
10963
* return <size_t>(-1)
10964
* return a*b
10965
*/
10966
}
10967
10968
/* "cysignals/memory.pxd":76
10969
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
10970
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
10971
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
10972
* if unlikely(b > (<size_t>-1) // a):
10973
* return <size_t>(-1)
10974
*/
10975
}
10976
10977
/* "cysignals/memory.pxd":79
10978
* if unlikely(b > (<size_t>-1) // a):
10979
* return <size_t>(-1)
10980
* return a*b # <<<<<<<<<<<<<<
10981
*
10982
*
10983
*/
10984
__pyx_r = (__pyx_v_a * __pyx_v_b);
10985
goto __pyx_L0;
10986
10987
/* "cysignals/memory.pxd":68
10988
*
10989
* @cython.cdivision(True)
10990
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
10991
* """
10992
* Return a*b, checking for overflow. Assume that a > 0.
10993
*/
10994
10995
/* function exit code */
10996
__pyx_L0:;
10997
return __pyx_r;
10998
}
10999
11000
/* "cysignals/memory.pxd":82
11001
*
11002
*
11003
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
11004
* """
11005
* Allocate memory for ``nmemb`` elements of size ``size``.
11006
*/
11007
11008
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
11009
size_t __pyx_v_n;
11010
void *__pyx_v_ret;
11011
void *__pyx_r;
11012
__Pyx_RefNannyDeclarations
11013
int __pyx_t_1;
11014
PyObject *__pyx_t_2 = NULL;
11015
PyObject *__pyx_t_3 = NULL;
11016
PyObject *__pyx_t_4 = NULL;
11017
__Pyx_RefNannySetupContext("check_allocarray", 0);
11018
11019
/* "cysignals/memory.pxd":86
11020
* Allocate memory for ``nmemb`` elements of size ``size``.
11021
* """
11022
* if nmemb == 0: # <<<<<<<<<<<<<<
11023
* return NULL
11024
* cdef size_t n = mul_overflowcheck(nmemb, size)
11025
*/
11026
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
11027
if (__pyx_t_1) {
11028
11029
/* "cysignals/memory.pxd":87
11030
* """
11031
* if nmemb == 0:
11032
* return NULL # <<<<<<<<<<<<<<
11033
* cdef size_t n = mul_overflowcheck(nmemb, size)
11034
* cdef void* ret = sig_malloc(n)
11035
*/
11036
__pyx_r = NULL;
11037
goto __pyx_L0;
11038
11039
/* "cysignals/memory.pxd":86
11040
* Allocate memory for ``nmemb`` elements of size ``size``.
11041
* """
11042
* if nmemb == 0: # <<<<<<<<<<<<<<
11043
* return NULL
11044
* cdef size_t n = mul_overflowcheck(nmemb, size)
11045
*/
11046
}
11047
11048
/* "cysignals/memory.pxd":88
11049
* if nmemb == 0:
11050
* return NULL
11051
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
11052
* cdef void* ret = sig_malloc(n)
11053
* if unlikely(ret == NULL):
11054
*/
11055
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
11056
11057
/* "cysignals/memory.pxd":89
11058
* return NULL
11059
* cdef size_t n = mul_overflowcheck(nmemb, size)
11060
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
11061
* if unlikely(ret == NULL):
11062
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11063
*/
11064
__pyx_v_ret = sig_malloc(__pyx_v_n);
11065
11066
/* "cysignals/memory.pxd":90
11067
* cdef size_t n = mul_overflowcheck(nmemb, size)
11068
* cdef void* ret = sig_malloc(n)
11069
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11070
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11071
* return ret
11072
*/
11073
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
11074
if (__pyx_t_1) {
11075
11076
/* "cysignals/memory.pxd":91
11077
* cdef void* ret = sig_malloc(n)
11078
* if unlikely(ret == NULL):
11079
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
11080
* return ret
11081
*
11082
*/
11083
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
11084
__Pyx_GOTREF(__pyx_t_2);
11085
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 91, __pyx_L1_error)
11086
__Pyx_GOTREF(__pyx_t_3);
11087
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 91, __pyx_L1_error)
11088
__Pyx_GOTREF(__pyx_t_4);
11089
__Pyx_GIVEREF(__pyx_t_2);
11090
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
11091
__Pyx_GIVEREF(__pyx_t_3);
11092
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
11093
__pyx_t_2 = 0;
11094
__pyx_t_3 = 0;
11095
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 91, __pyx_L1_error)
11096
__Pyx_GOTREF(__pyx_t_3);
11097
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11098
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 91, __pyx_L1_error)
11099
__Pyx_GOTREF(__pyx_t_4);
11100
__Pyx_GIVEREF(__pyx_t_3);
11101
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
11102
__pyx_t_3 = 0;
11103
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 91, __pyx_L1_error)
11104
__Pyx_GOTREF(__pyx_t_3);
11105
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11106
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
11107
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11108
__PYX_ERR(1, 91, __pyx_L1_error)
11109
11110
/* "cysignals/memory.pxd":90
11111
* cdef size_t n = mul_overflowcheck(nmemb, size)
11112
* cdef void* ret = sig_malloc(n)
11113
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11114
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11115
* return ret
11116
*/
11117
}
11118
11119
/* "cysignals/memory.pxd":92
11120
* if unlikely(ret == NULL):
11121
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11122
* return ret # <<<<<<<<<<<<<<
11123
*
11124
*
11125
*/
11126
__pyx_r = __pyx_v_ret;
11127
goto __pyx_L0;
11128
11129
/* "cysignals/memory.pxd":82
11130
*
11131
*
11132
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
11133
* """
11134
* Allocate memory for ``nmemb`` elements of size ``size``.
11135
*/
11136
11137
/* function exit code */
11138
__pyx_L1_error:;
11139
__Pyx_XDECREF(__pyx_t_2);
11140
__Pyx_XDECREF(__pyx_t_3);
11141
__Pyx_XDECREF(__pyx_t_4);
11142
__Pyx_AddTraceback("cysignals.memory.check_allocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
11143
__pyx_r = NULL;
11144
__pyx_L0:;
11145
__Pyx_RefNannyFinishContext();
11146
return __pyx_r;
11147
}
11148
11149
/* "cysignals/memory.pxd":95
11150
*
11151
*
11152
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
11153
* """
11154
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
11155
*/
11156
11157
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *__pyx_v_ptr, size_t __pyx_v_nmemb, size_t __pyx_v_size) {
11158
size_t __pyx_v_n;
11159
void *__pyx_v_ret;
11160
void *__pyx_r;
11161
__Pyx_RefNannyDeclarations
11162
int __pyx_t_1;
11163
PyObject *__pyx_t_2 = NULL;
11164
PyObject *__pyx_t_3 = NULL;
11165
PyObject *__pyx_t_4 = NULL;
11166
__Pyx_RefNannySetupContext("check_reallocarray", 0);
11167
11168
/* "cysignals/memory.pxd":103
11169
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
11170
* """
11171
* if nmemb == 0: # <<<<<<<<<<<<<<
11172
* sig_free(ptr)
11173
* return NULL
11174
*/
11175
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
11176
if (__pyx_t_1) {
11177
11178
/* "cysignals/memory.pxd":104
11179
* """
11180
* if nmemb == 0:
11181
* sig_free(ptr) # <<<<<<<<<<<<<<
11182
* return NULL
11183
* cdef size_t n = mul_overflowcheck(nmemb, size)
11184
*/
11185
sig_free(__pyx_v_ptr);
11186
11187
/* "cysignals/memory.pxd":105
11188
* if nmemb == 0:
11189
* sig_free(ptr)
11190
* return NULL # <<<<<<<<<<<<<<
11191
* cdef size_t n = mul_overflowcheck(nmemb, size)
11192
* cdef void* ret = sig_realloc(ptr, n)
11193
*/
11194
__pyx_r = NULL;
11195
goto __pyx_L0;
11196
11197
/* "cysignals/memory.pxd":103
11198
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
11199
* """
11200
* if nmemb == 0: # <<<<<<<<<<<<<<
11201
* sig_free(ptr)
11202
* return NULL
11203
*/
11204
}
11205
11206
/* "cysignals/memory.pxd":106
11207
* sig_free(ptr)
11208
* return NULL
11209
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
11210
* cdef void* ret = sig_realloc(ptr, n)
11211
* if unlikely(ret == NULL):
11212
*/
11213
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
11214
11215
/* "cysignals/memory.pxd":107
11216
* return NULL
11217
* cdef size_t n = mul_overflowcheck(nmemb, size)
11218
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
11219
* if unlikely(ret == NULL):
11220
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11221
*/
11222
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
11223
11224
/* "cysignals/memory.pxd":108
11225
* cdef size_t n = mul_overflowcheck(nmemb, size)
11226
* cdef void* ret = sig_realloc(ptr, n)
11227
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11228
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11229
* return ret
11230
*/
11231
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
11232
if (__pyx_t_1) {
11233
11234
/* "cysignals/memory.pxd":109
11235
* cdef void* ret = sig_realloc(ptr, n)
11236
* if unlikely(ret == NULL):
11237
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
11238
* return ret
11239
*
11240
*/
11241
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 109, __pyx_L1_error)
11242
__Pyx_GOTREF(__pyx_t_2);
11243
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 109, __pyx_L1_error)
11244
__Pyx_GOTREF(__pyx_t_3);
11245
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 109, __pyx_L1_error)
11246
__Pyx_GOTREF(__pyx_t_4);
11247
__Pyx_GIVEREF(__pyx_t_2);
11248
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
11249
__Pyx_GIVEREF(__pyx_t_3);
11250
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
11251
__pyx_t_2 = 0;
11252
__pyx_t_3 = 0;
11253
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 109, __pyx_L1_error)
11254
__Pyx_GOTREF(__pyx_t_3);
11255
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11256
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 109, __pyx_L1_error)
11257
__Pyx_GOTREF(__pyx_t_4);
11258
__Pyx_GIVEREF(__pyx_t_3);
11259
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
11260
__pyx_t_3 = 0;
11261
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 109, __pyx_L1_error)
11262
__Pyx_GOTREF(__pyx_t_3);
11263
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11264
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
11265
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11266
__PYX_ERR(1, 109, __pyx_L1_error)
11267
11268
/* "cysignals/memory.pxd":108
11269
* cdef size_t n = mul_overflowcheck(nmemb, size)
11270
* cdef void* ret = sig_realloc(ptr, n)
11271
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11272
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11273
* return ret
11274
*/
11275
}
11276
11277
/* "cysignals/memory.pxd":110
11278
* if unlikely(ret == NULL):
11279
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11280
* return ret # <<<<<<<<<<<<<<
11281
*
11282
*
11283
*/
11284
__pyx_r = __pyx_v_ret;
11285
goto __pyx_L0;
11286
11287
/* "cysignals/memory.pxd":95
11288
*
11289
*
11290
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
11291
* """
11292
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
11293
*/
11294
11295
/* function exit code */
11296
__pyx_L1_error:;
11297
__Pyx_XDECREF(__pyx_t_2);
11298
__Pyx_XDECREF(__pyx_t_3);
11299
__Pyx_XDECREF(__pyx_t_4);
11300
__Pyx_AddTraceback("cysignals.memory.check_reallocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
11301
__pyx_r = NULL;
11302
__pyx_L0:;
11303
__Pyx_RefNannyFinishContext();
11304
return __pyx_r;
11305
}
11306
11307
/* "cysignals/memory.pxd":113
11308
*
11309
*
11310
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
11311
* """
11312
* Allocate ``n`` bytes of memory.
11313
*/
11314
11315
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t __pyx_v_n) {
11316
void *__pyx_v_ret;
11317
void *__pyx_r;
11318
__Pyx_RefNannyDeclarations
11319
int __pyx_t_1;
11320
PyObject *__pyx_t_2 = NULL;
11321
PyObject *__pyx_t_3 = NULL;
11322
__Pyx_RefNannySetupContext("check_malloc", 0);
11323
11324
/* "cysignals/memory.pxd":117
11325
* Allocate ``n`` bytes of memory.
11326
* """
11327
* if n == 0: # <<<<<<<<<<<<<<
11328
* return NULL
11329
* cdef void* ret = sig_malloc(n)
11330
*/
11331
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
11332
if (__pyx_t_1) {
11333
11334
/* "cysignals/memory.pxd":118
11335
* """
11336
* if n == 0:
11337
* return NULL # <<<<<<<<<<<<<<
11338
* cdef void* ret = sig_malloc(n)
11339
* if unlikely(ret == NULL):
11340
*/
11341
__pyx_r = NULL;
11342
goto __pyx_L0;
11343
11344
/* "cysignals/memory.pxd":117
11345
* Allocate ``n`` bytes of memory.
11346
* """
11347
* if n == 0: # <<<<<<<<<<<<<<
11348
* return NULL
11349
* cdef void* ret = sig_malloc(n)
11350
*/
11351
}
11352
11353
/* "cysignals/memory.pxd":119
11354
* if n == 0:
11355
* return NULL
11356
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
11357
* if unlikely(ret == NULL):
11358
* raise MemoryError("failed to allocate %s bytes" % n)
11359
*/
11360
__pyx_v_ret = sig_malloc(__pyx_v_n);
11361
11362
/* "cysignals/memory.pxd":120
11363
* return NULL
11364
* cdef void* ret = sig_malloc(n)
11365
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11366
* raise MemoryError("failed to allocate %s bytes" % n)
11367
* return ret
11368
*/
11369
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
11370
if (__pyx_t_1) {
11371
11372
/* "cysignals/memory.pxd":121
11373
* cdef void* ret = sig_malloc(n)
11374
* if unlikely(ret == NULL):
11375
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
11376
* return ret
11377
*
11378
*/
11379
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 121, __pyx_L1_error)
11380
__Pyx_GOTREF(__pyx_t_2);
11381
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 121, __pyx_L1_error)
11382
__Pyx_GOTREF(__pyx_t_3);
11383
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11384
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 121, __pyx_L1_error)
11385
__Pyx_GOTREF(__pyx_t_2);
11386
__Pyx_GIVEREF(__pyx_t_3);
11387
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
11388
__pyx_t_3 = 0;
11389
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 121, __pyx_L1_error)
11390
__Pyx_GOTREF(__pyx_t_3);
11391
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11392
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
11393
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11394
__PYX_ERR(1, 121, __pyx_L1_error)
11395
11396
/* "cysignals/memory.pxd":120
11397
* return NULL
11398
* cdef void* ret = sig_malloc(n)
11399
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11400
* raise MemoryError("failed to allocate %s bytes" % n)
11401
* return ret
11402
*/
11403
}
11404
11405
/* "cysignals/memory.pxd":122
11406
* if unlikely(ret == NULL):
11407
* raise MemoryError("failed to allocate %s bytes" % n)
11408
* return ret # <<<<<<<<<<<<<<
11409
*
11410
*
11411
*/
11412
__pyx_r = __pyx_v_ret;
11413
goto __pyx_L0;
11414
11415
/* "cysignals/memory.pxd":113
11416
*
11417
*
11418
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
11419
* """
11420
* Allocate ``n`` bytes of memory.
11421
*/
11422
11423
/* function exit code */
11424
__pyx_L1_error:;
11425
__Pyx_XDECREF(__pyx_t_2);
11426
__Pyx_XDECREF(__pyx_t_3);
11427
__Pyx_AddTraceback("cysignals.memory.check_malloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11428
__pyx_r = NULL;
11429
__pyx_L0:;
11430
__Pyx_RefNannyFinishContext();
11431
return __pyx_r;
11432
}
11433
11434
/* "cysignals/memory.pxd":125
11435
*
11436
*
11437
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
11438
* """
11439
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
11440
*/
11441
11442
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *__pyx_v_ptr, size_t __pyx_v_n) {
11443
void *__pyx_v_ret;
11444
void *__pyx_r;
11445
__Pyx_RefNannyDeclarations
11446
int __pyx_t_1;
11447
PyObject *__pyx_t_2 = NULL;
11448
PyObject *__pyx_t_3 = NULL;
11449
__Pyx_RefNannySetupContext("check_realloc", 0);
11450
11451
/* "cysignals/memory.pxd":130
11452
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
11453
* """
11454
* if n == 0: # <<<<<<<<<<<<<<
11455
* sig_free(ptr)
11456
* return NULL
11457
*/
11458
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
11459
if (__pyx_t_1) {
11460
11461
/* "cysignals/memory.pxd":131
11462
* """
11463
* if n == 0:
11464
* sig_free(ptr) # <<<<<<<<<<<<<<
11465
* return NULL
11466
* cdef void* ret = sig_realloc(ptr, n)
11467
*/
11468
sig_free(__pyx_v_ptr);
11469
11470
/* "cysignals/memory.pxd":132
11471
* if n == 0:
11472
* sig_free(ptr)
11473
* return NULL # <<<<<<<<<<<<<<
11474
* cdef void* ret = sig_realloc(ptr, n)
11475
* if unlikely(ret == NULL):
11476
*/
11477
__pyx_r = NULL;
11478
goto __pyx_L0;
11479
11480
/* "cysignals/memory.pxd":130
11481
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
11482
* """
11483
* if n == 0: # <<<<<<<<<<<<<<
11484
* sig_free(ptr)
11485
* return NULL
11486
*/
11487
}
11488
11489
/* "cysignals/memory.pxd":133
11490
* sig_free(ptr)
11491
* return NULL
11492
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
11493
* if unlikely(ret == NULL):
11494
* raise MemoryError("failed to allocate %s bytes" % n)
11495
*/
11496
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
11497
11498
/* "cysignals/memory.pxd":134
11499
* return NULL
11500
* cdef void* ret = sig_realloc(ptr, n)
11501
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11502
* raise MemoryError("failed to allocate %s bytes" % n)
11503
* return ret
11504
*/
11505
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
11506
if (__pyx_t_1) {
11507
11508
/* "cysignals/memory.pxd":135
11509
* cdef void* ret = sig_realloc(ptr, n)
11510
* if unlikely(ret == NULL):
11511
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
11512
* return ret
11513
*
11514
*/
11515
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 135, __pyx_L1_error)
11516
__Pyx_GOTREF(__pyx_t_2);
11517
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 135, __pyx_L1_error)
11518
__Pyx_GOTREF(__pyx_t_3);
11519
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11520
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 135, __pyx_L1_error)
11521
__Pyx_GOTREF(__pyx_t_2);
11522
__Pyx_GIVEREF(__pyx_t_3);
11523
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
11524
__pyx_t_3 = 0;
11525
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 135, __pyx_L1_error)
11526
__Pyx_GOTREF(__pyx_t_3);
11527
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11528
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
11529
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11530
__PYX_ERR(1, 135, __pyx_L1_error)
11531
11532
/* "cysignals/memory.pxd":134
11533
* return NULL
11534
* cdef void* ret = sig_realloc(ptr, n)
11535
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11536
* raise MemoryError("failed to allocate %s bytes" % n)
11537
* return ret
11538
*/
11539
}
11540
11541
/* "cysignals/memory.pxd":136
11542
* if unlikely(ret == NULL):
11543
* raise MemoryError("failed to allocate %s bytes" % n)
11544
* return ret # <<<<<<<<<<<<<<
11545
*
11546
*
11547
*/
11548
__pyx_r = __pyx_v_ret;
11549
goto __pyx_L0;
11550
11551
/* "cysignals/memory.pxd":125
11552
*
11553
*
11554
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
11555
* """
11556
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
11557
*/
11558
11559
/* function exit code */
11560
__pyx_L1_error:;
11561
__Pyx_XDECREF(__pyx_t_2);
11562
__Pyx_XDECREF(__pyx_t_3);
11563
__Pyx_AddTraceback("cysignals.memory.check_realloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11564
__pyx_r = NULL;
11565
__pyx_L0:;
11566
__Pyx_RefNannyFinishContext();
11567
return __pyx_r;
11568
}
11569
11570
/* "cysignals/memory.pxd":139
11571
*
11572
*
11573
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
11574
* """
11575
* Allocate memory for ``nmemb`` elements of size ``size``. The
11576
*/
11577
11578
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
11579
void *__pyx_v_ret;
11580
void *__pyx_r;
11581
__Pyx_RefNannyDeclarations
11582
int __pyx_t_1;
11583
PyObject *__pyx_t_2 = NULL;
11584
PyObject *__pyx_t_3 = NULL;
11585
PyObject *__pyx_t_4 = NULL;
11586
__Pyx_RefNannySetupContext("check_calloc", 0);
11587
11588
/* "cysignals/memory.pxd":144
11589
* resulting memory is zeroed.
11590
* """
11591
* if nmemb == 0: # <<<<<<<<<<<<<<
11592
* return NULL
11593
* cdef void* ret = sig_calloc(nmemb, size)
11594
*/
11595
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
11596
if (__pyx_t_1) {
11597
11598
/* "cysignals/memory.pxd":145
11599
* """
11600
* if nmemb == 0:
11601
* return NULL # <<<<<<<<<<<<<<
11602
* cdef void* ret = sig_calloc(nmemb, size)
11603
* if unlikely(ret == NULL):
11604
*/
11605
__pyx_r = NULL;
11606
goto __pyx_L0;
11607
11608
/* "cysignals/memory.pxd":144
11609
* resulting memory is zeroed.
11610
* """
11611
* if nmemb == 0: # <<<<<<<<<<<<<<
11612
* return NULL
11613
* cdef void* ret = sig_calloc(nmemb, size)
11614
*/
11615
}
11616
11617
/* "cysignals/memory.pxd":146
11618
* if nmemb == 0:
11619
* return NULL
11620
* cdef void* ret = sig_calloc(nmemb, size) # <<<<<<<<<<<<<<
11621
* if unlikely(ret == NULL):
11622
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11623
*/
11624
__pyx_v_ret = sig_calloc(__pyx_v_nmemb, __pyx_v_size);
11625
11626
/* "cysignals/memory.pxd":147
11627
* return NULL
11628
* cdef void* ret = sig_calloc(nmemb, size)
11629
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11630
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11631
* return ret
11632
*/
11633
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
11634
if (__pyx_t_1) {
11635
11636
/* "cysignals/memory.pxd":148
11637
* cdef void* ret = sig_calloc(nmemb, size)
11638
* if unlikely(ret == NULL):
11639
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
11640
* return ret
11641
*/
11642
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 148, __pyx_L1_error)
11643
__Pyx_GOTREF(__pyx_t_2);
11644
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
11645
__Pyx_GOTREF(__pyx_t_3);
11646
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 148, __pyx_L1_error)
11647
__Pyx_GOTREF(__pyx_t_4);
11648
__Pyx_GIVEREF(__pyx_t_2);
11649
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
11650
__Pyx_GIVEREF(__pyx_t_3);
11651
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
11652
__pyx_t_2 = 0;
11653
__pyx_t_3 = 0;
11654
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
11655
__Pyx_GOTREF(__pyx_t_3);
11656
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11657
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 148, __pyx_L1_error)
11658
__Pyx_GOTREF(__pyx_t_4);
11659
__Pyx_GIVEREF(__pyx_t_3);
11660
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
11661
__pyx_t_3 = 0;
11662
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
11663
__Pyx_GOTREF(__pyx_t_3);
11664
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11665
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
11666
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11667
__PYX_ERR(1, 148, __pyx_L1_error)
11668
11669
/* "cysignals/memory.pxd":147
11670
* return NULL
11671
* cdef void* ret = sig_calloc(nmemb, size)
11672
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
11673
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11674
* return ret
11675
*/
11676
}
11677
11678
/* "cysignals/memory.pxd":149
11679
* if unlikely(ret == NULL):
11680
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
11681
* return ret # <<<<<<<<<<<<<<
11682
*/
11683
__pyx_r = __pyx_v_ret;
11684
goto __pyx_L0;
11685
11686
/* "cysignals/memory.pxd":139
11687
*
11688
*
11689
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
11690
* """
11691
* Allocate memory for ``nmemb`` elements of size ``size``. The
11692
*/
11693
11694
/* function exit code */
11695
__pyx_L1_error:;
11696
__Pyx_XDECREF(__pyx_t_2);
11697
__Pyx_XDECREF(__pyx_t_3);
11698
__Pyx_XDECREF(__pyx_t_4);
11699
__Pyx_AddTraceback("cysignals.memory.check_calloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
11700
__pyx_r = NULL;
11701
__pyx_L0:;
11702
__Pyx_RefNannyFinishContext();
11703
return __pyx_r;
11704
}
11705
11706
/* "sage/structure/sage_object.pxd":13
11707
*
11708
*
11709
* cpdef inline richcmp_not_equal(x, y, int op): # <<<<<<<<<<<<<<
11710
* """
11711
* Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.
11712
*/
11713
11714
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11715
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) {
11716
PyObject *__pyx_r = NULL;
11717
__Pyx_RefNannyDeclarations
11718
int __pyx_t_1;
11719
PyObject *__pyx_t_2 = NULL;
11720
__Pyx_RefNannySetupContext("richcmp_not_equal", 0);
11721
11722
/* "sage/structure/sage_object.pxd":70
11723
* True
11724
* """
11725
* if op == Py_EQ: # <<<<<<<<<<<<<<
11726
* return False
11727
* elif op == Py_NE:
11728
*/
11729
__pyx_t_1 = ((__pyx_v_op == Py_EQ) != 0);
11730
if (__pyx_t_1) {
11731
11732
/* "sage/structure/sage_object.pxd":71
11733
* """
11734
* if op == Py_EQ:
11735
* return False # <<<<<<<<<<<<<<
11736
* elif op == Py_NE:
11737
* return True
11738
*/
11739
__Pyx_XDECREF(__pyx_r);
11740
__Pyx_INCREF(Py_False);
11741
__pyx_r = Py_False;
11742
goto __pyx_L0;
11743
11744
/* "sage/structure/sage_object.pxd":70
11745
* True
11746
* """
11747
* if op == Py_EQ: # <<<<<<<<<<<<<<
11748
* return False
11749
* elif op == Py_NE:
11750
*/
11751
}
11752
11753
/* "sage/structure/sage_object.pxd":72
11754
* if op == Py_EQ:
11755
* return False
11756
* elif op == Py_NE: # <<<<<<<<<<<<<<
11757
* return True
11758
* return richcmp(x, y, op)
11759
*/
11760
__pyx_t_1 = ((__pyx_v_op == Py_NE) != 0);
11761
if (__pyx_t_1) {
11762
11763
/* "sage/structure/sage_object.pxd":73
11764
* return False
11765
* elif op == Py_NE:
11766
* return True # <<<<<<<<<<<<<<
11767
* return richcmp(x, y, op)
11768
*
11769
*/
11770
__Pyx_XDECREF(__pyx_r);
11771
__Pyx_INCREF(Py_True);
11772
__pyx_r = Py_True;
11773
goto __pyx_L0;
11774
11775
/* "sage/structure/sage_object.pxd":72
11776
* if op == Py_EQ:
11777
* return False
11778
* elif op == Py_NE: # <<<<<<<<<<<<<<
11779
* return True
11780
* return richcmp(x, y, op)
11781
*/
11782
}
11783
11784
/* "sage/structure/sage_object.pxd":74
11785
* elif op == Py_NE:
11786
* return True
11787
* return richcmp(x, y, op) # <<<<<<<<<<<<<<
11788
*
11789
*
11790
*/
11791
__Pyx_XDECREF(__pyx_r);
11792
__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)
11793
__Pyx_GOTREF(__pyx_t_2);
11794
__pyx_r = __pyx_t_2;
11795
__pyx_t_2 = 0;
11796
goto __pyx_L0;
11797
11798
/* "sage/structure/sage_object.pxd":13
11799
*
11800
*
11801
* cpdef inline richcmp_not_equal(x, y, int op): # <<<<<<<<<<<<<<
11802
* """
11803
* Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.
11804
*/
11805
11806
/* function exit code */
11807
__pyx_L1_error:;
11808
__Pyx_XDECREF(__pyx_t_2);
11809
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
11810
__pyx_r = 0;
11811
__pyx_L0:;
11812
__Pyx_XGIVEREF(__pyx_r);
11813
__Pyx_RefNannyFinishContext();
11814
return __pyx_r;
11815
}
11816
11817
/* Python wrapper */
11818
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11819
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 ";
11820
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11821
PyObject *__pyx_v_x = 0;
11822
PyObject *__pyx_v_y = 0;
11823
int __pyx_v_op;
11824
PyObject *__pyx_r = 0;
11825
__Pyx_RefNannyDeclarations
11826
__Pyx_RefNannySetupContext("richcmp_not_equal (wrapper)", 0);
11827
{
11828
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_op,0};
11829
PyObject* values[3] = {0,0,0};
11830
if (unlikely(__pyx_kwds)) {
11831
Py_ssize_t kw_args;
11832
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11833
switch (pos_args) {
11834
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11835
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11836
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11837
case 0: break;
11838
default: goto __pyx_L5_argtuple_error;
11839
}
11840
kw_args = PyDict_Size(__pyx_kwds);
11841
switch (pos_args) {
11842
case 0:
11843
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
11844
else goto __pyx_L5_argtuple_error;
11845
case 1:
11846
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
11847
else {
11848
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, 1); __PYX_ERR(2, 13, __pyx_L3_error)
11849
}
11850
case 2:
11851
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
11852
else {
11853
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, 2); __PYX_ERR(2, 13, __pyx_L3_error)
11854
}
11855
}
11856
if (unlikely(kw_args > 0)) {
11857
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "richcmp_not_equal") < 0)) __PYX_ERR(2, 13, __pyx_L3_error)
11858
}
11859
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
11860
goto __pyx_L5_argtuple_error;
11861
} else {
11862
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11863
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11864
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11865
}
11866
__pyx_v_x = values[0];
11867
__pyx_v_y = values[1];
11868
__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)
11869
}
11870
goto __pyx_L4_argument_unpacking_done;
11871
__pyx_L5_argtuple_error:;
11872
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 13, __pyx_L3_error)
11873
__pyx_L3_error:;
11874
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
11875
__Pyx_RefNannyFinishContext();
11876
return NULL;
11877
__pyx_L4_argument_unpacking_done:;
11878
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_op);
11879
11880
/* function exit code */
11881
__Pyx_RefNannyFinishContext();
11882
return __pyx_r;
11883
}
11884
11885
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) {
11886
PyObject *__pyx_r = NULL;
11887
__Pyx_RefNannyDeclarations
11888
PyObject *__pyx_t_1 = NULL;
11889
__Pyx_RefNannySetupContext("richcmp_not_equal", 0);
11890
__Pyx_XDECREF(__pyx_r);
11891
__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)
11892
__Pyx_GOTREF(__pyx_t_1);
11893
__pyx_r = __pyx_t_1;
11894
__pyx_t_1 = 0;
11895
goto __pyx_L0;
11896
11897
/* function exit code */
11898
__pyx_L1_error:;
11899
__Pyx_XDECREF(__pyx_t_1);
11900
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
11901
__pyx_r = NULL;
11902
__pyx_L0:;
11903
__Pyx_XGIVEREF(__pyx_r);
11904
__Pyx_RefNannyFinishContext();
11905
return __pyx_r;
11906
}
11907
11908
/* "sage/structure/sage_object.pxd":77
11909
*
11910
*
11911
* cpdef inline bint rich_to_bool(int op, int c): # <<<<<<<<<<<<<<
11912
* """
11913
* Return the corresponding ``True`` or ``False`` value for a rich
11914
*/
11915
11916
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11917
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) {
11918
uint32_t __pyx_v_less_bits;
11919
uint32_t __pyx_v_equal_bits;
11920
uint32_t __pyx_v_greater_bits;
11921
uint32_t __pyx_v_bits;
11922
int __pyx_v_shift;
11923
int __pyx_r;
11924
__Pyx_RefNannyDeclarations
11925
__Pyx_RefNannySetupContext("rich_to_bool", 0);
11926
11927
/* "sage/structure/sage_object.pxd":139
11928
* # The 4 lines below involve just constants, so the compiler should
11929
* # optimize them to just one constant value for "bits".
11930
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE) # <<<<<<<<<<<<<<
11931
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
11932
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
11933
*/
11934
__pyx_v_less_bits = (((1 << Py_LT) + (1 << Py_LE)) + (1 << Py_NE));
11935
11936
/* "sage/structure/sage_object.pxd":140
11937
* # optimize them to just one constant value for "bits".
11938
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE)
11939
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ) # <<<<<<<<<<<<<<
11940
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
11941
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
11942
*/
11943
__pyx_v_equal_bits = (((1 << Py_LE) + (1 << Py_GE)) + (1 << Py_EQ));
11944
11945
/* "sage/structure/sage_object.pxd":141
11946
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE)
11947
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
11948
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE) # <<<<<<<<<<<<<<
11949
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
11950
*
11951
*/
11952
__pyx_v_greater_bits = (((1 << Py_GT) + (1 << Py_GE)) + (1 << Py_NE));
11953
11954
/* "sage/structure/sage_object.pxd":142
11955
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
11956
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
11957
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8) # <<<<<<<<<<<<<<
11958
*
11959
* cdef int shift = 8*c + op
11960
*/
11961
__pyx_v_bits = (((__pyx_v_less_bits << 24) + __pyx_v_equal_bits) + (__pyx_v_greater_bits << 8));
11962
11963
/* "sage/structure/sage_object.pxd":144
11964
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
11965
*
11966
* cdef int shift = 8*c + op # <<<<<<<<<<<<<<
11967
*
11968
* # The shift masking (shift & 31) will likely be optimized away by
11969
*/
11970
__pyx_v_shift = ((8 * __pyx_v_c) + __pyx_v_op);
11971
11972
/* "sage/structure/sage_object.pxd":149
11973
* # the compiler since shift and bit test instructions implicitly
11974
* # mask their offset.
11975
* return (bits >> (shift & 31)) & 1 # <<<<<<<<<<<<<<
11976
*
11977
*
11978
*/
11979
__pyx_r = ((__pyx_v_bits >> (__pyx_v_shift & 31)) & 1);
11980
goto __pyx_L0;
11981
11982
/* "sage/structure/sage_object.pxd":77
11983
*
11984
*
11985
* cpdef inline bint rich_to_bool(int op, int c): # <<<<<<<<<<<<<<
11986
* """
11987
* Return the corresponding ``True`` or ``False`` value for a rich
11988
*/
11989
11990
/* function exit code */
11991
__pyx_L0:;
11992
__Pyx_RefNannyFinishContext();
11993
return __pyx_r;
11994
}
11995
11996
/* Python wrapper */
11997
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11998
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 ";
11999
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12000
int __pyx_v_op;
12001
int __pyx_v_c;
12002
PyObject *__pyx_r = 0;
12003
__Pyx_RefNannyDeclarations
12004
__Pyx_RefNannySetupContext("rich_to_bool (wrapper)", 0);
12005
{
12006
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_op,&__pyx_n_s_c,0};
12007
PyObject* values[2] = {0,0};
12008
if (unlikely(__pyx_kwds)) {
12009
Py_ssize_t kw_args;
12010
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12011
switch (pos_args) {
12012
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12013
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12014
case 0: break;
12015
default: goto __pyx_L5_argtuple_error;
12016
}
12017
kw_args = PyDict_Size(__pyx_kwds);
12018
switch (pos_args) {
12019
case 0:
12020
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
12021
else goto __pyx_L5_argtuple_error;
12022
case 1:
12023
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
12024
else {
12025
__Pyx_RaiseArgtupleInvalid("rich_to_bool", 1, 2, 2, 1); __PYX_ERR(2, 77, __pyx_L3_error)
12026
}
12027
}
12028
if (unlikely(kw_args > 0)) {
12029
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rich_to_bool") < 0)) __PYX_ERR(2, 77, __pyx_L3_error)
12030
}
12031
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
12032
goto __pyx_L5_argtuple_error;
12033
} else {
12034
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12035
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12036
}
12037
__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)
12038
__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)
12039
}
12040
goto __pyx_L4_argument_unpacking_done;
12041
__pyx_L5_argtuple_error:;
12042
__Pyx_RaiseArgtupleInvalid("rich_to_bool", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 77, __pyx_L3_error)
12043
__pyx_L3_error:;
12044
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
12045
__Pyx_RefNannyFinishContext();
12046
return NULL;
12047
__pyx_L4_argument_unpacking_done:;
12048
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(__pyx_self, __pyx_v_op, __pyx_v_c);
12049
12050
/* function exit code */
12051
__Pyx_RefNannyFinishContext();
12052
return __pyx_r;
12053
}
12054
12055
static PyObject *__pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c) {
12056
PyObject *__pyx_r = NULL;
12057
__Pyx_RefNannyDeclarations
12058
PyObject *__pyx_t_1 = NULL;
12059
__Pyx_RefNannySetupContext("rich_to_bool", 0);
12060
__Pyx_XDECREF(__pyx_r);
12061
__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)
12062
__Pyx_GOTREF(__pyx_t_1);
12063
__pyx_r = __pyx_t_1;
12064
__pyx_t_1 = 0;
12065
goto __pyx_L0;
12066
12067
/* function exit code */
12068
__pyx_L1_error:;
12069
__Pyx_XDECREF(__pyx_t_1);
12070
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
12071
__pyx_r = NULL;
12072
__pyx_L0:;
12073
__Pyx_XGIVEREF(__pyx_r);
12074
__Pyx_RefNannyFinishContext();
12075
return __pyx_r;
12076
}
12077
12078
/* "sage/structure/sage_object.pxd":152
12079
*
12080
*
12081
* cpdef inline bint rich_to_bool_sgn(int op, int c): # <<<<<<<<<<<<<<
12082
* """
12083
* Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`
12084
*/
12085
12086
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12087
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) {
12088
int __pyx_r;
12089
__Pyx_RefNannyDeclarations
12090
__Pyx_RefNannySetupContext("rich_to_bool_sgn", 0);
12091
12092
/* "sage/structure/sage_object.pxd":161
12093
* This is in particular needed for ``mpz_cmp()``.
12094
* """
12095
* return rich_to_bool(op, (c > 0) - (c < 0)) # <<<<<<<<<<<<<<
12096
*/
12097
__pyx_r = __pyx_f_4sage_9structure_11sage_object_rich_to_bool(__pyx_v_op, ((__pyx_v_c > 0) - (__pyx_v_c < 0)), 0);
12098
goto __pyx_L0;
12099
12100
/* "sage/structure/sage_object.pxd":152
12101
*
12102
*
12103
* cpdef inline bint rich_to_bool_sgn(int op, int c): # <<<<<<<<<<<<<<
12104
* """
12105
* Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`
12106
*/
12107
12108
/* function exit code */
12109
__pyx_L0:;
12110
__Pyx_RefNannyFinishContext();
12111
return __pyx_r;
12112
}
12113
12114
/* Python wrapper */
12115
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12116
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 ";
12117
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12118
int __pyx_v_op;
12119
int __pyx_v_c;
12120
PyObject *__pyx_r = 0;
12121
__Pyx_RefNannyDeclarations
12122
__Pyx_RefNannySetupContext("rich_to_bool_sgn (wrapper)", 0);
12123
{
12124
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_op,&__pyx_n_s_c,0};
12125
PyObject* values[2] = {0,0};
12126
if (unlikely(__pyx_kwds)) {
12127
Py_ssize_t kw_args;
12128
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12129
switch (pos_args) {
12130
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12131
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12132
case 0: break;
12133
default: goto __pyx_L5_argtuple_error;
12134
}
12135
kw_args = PyDict_Size(__pyx_kwds);
12136
switch (pos_args) {
12137
case 0:
12138
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
12139
else goto __pyx_L5_argtuple_error;
12140
case 1:
12141
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
12142
else {
12143
__Pyx_RaiseArgtupleInvalid("rich_to_bool_sgn", 1, 2, 2, 1); __PYX_ERR(2, 152, __pyx_L3_error)
12144
}
12145
}
12146
if (unlikely(kw_args > 0)) {
12147
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rich_to_bool_sgn") < 0)) __PYX_ERR(2, 152, __pyx_L3_error)
12148
}
12149
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
12150
goto __pyx_L5_argtuple_error;
12151
} else {
12152
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12153
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12154
}
12155
__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)
12156
__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)
12157
}
12158
goto __pyx_L4_argument_unpacking_done;
12159
__pyx_L5_argtuple_error:;
12160
__Pyx_RaiseArgtupleInvalid("rich_to_bool_sgn", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 152, __pyx_L3_error)
12161
__pyx_L3_error:;
12162
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool_sgn", __pyx_clineno, __pyx_lineno, __pyx_filename);
12163
__Pyx_RefNannyFinishContext();
12164
return NULL;
12165
__pyx_L4_argument_unpacking_done:;
12166
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(__pyx_self, __pyx_v_op, __pyx_v_c);
12167
12168
/* function exit code */
12169
__Pyx_RefNannyFinishContext();
12170
return __pyx_r;
12171
}
12172
12173
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) {
12174
PyObject *__pyx_r = NULL;
12175
__Pyx_RefNannyDeclarations
12176
PyObject *__pyx_t_1 = NULL;
12177
__Pyx_RefNannySetupContext("rich_to_bool_sgn", 0);
12178
__Pyx_XDECREF(__pyx_r);
12179
__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)
12180
__Pyx_GOTREF(__pyx_t_1);
12181
__pyx_r = __pyx_t_1;
12182
__pyx_t_1 = 0;
12183
goto __pyx_L0;
12184
12185
/* function exit code */
12186
__pyx_L1_error:;
12187
__Pyx_XDECREF(__pyx_t_1);
12188
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool_sgn", __pyx_clineno, __pyx_lineno, __pyx_filename);
12189
__pyx_r = NULL;
12190
__pyx_L0:;
12191
__Pyx_XGIVEREF(__pyx_r);
12192
__Pyx_RefNannyFinishContext();
12193
return __pyx_r;
12194
}
12195
12196
/* "sage/structure/element.pxd":7
12197
*
12198
*
12199
* cpdef inline parent(x): # <<<<<<<<<<<<<<
12200
* """
12201
* Return the parent of the element ``x``.
12202
*/
12203
12204
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
12205
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
12206
PyObject *__pyx_v_p = NULL;
12207
PyObject *__pyx_r = NULL;
12208
__Pyx_RefNannyDeclarations
12209
int __pyx_t_1;
12210
int __pyx_t_2;
12211
PyObject *__pyx_t_3 = NULL;
12212
PyObject *__pyx_t_4 = NULL;
12213
PyObject *__pyx_t_5 = NULL;
12214
PyObject *__pyx_t_6 = NULL;
12215
PyObject *__pyx_t_7 = NULL;
12216
PyObject *__pyx_t_8 = NULL;
12217
int __pyx_t_9;
12218
__Pyx_RefNannySetupContext("parent", 0);
12219
12220
/* "sage/structure/element.pxd":63
12221
* <... 'list'>
12222
* """
12223
* if isinstance(x, Element): # <<<<<<<<<<<<<<
12224
* return (<Element>x)._parent
12225
* # Fast check for "number" types, including int and float
12226
*/
12227
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, __pyx_ptype_4sage_9structure_7element_Element);
12228
__pyx_t_2 = (__pyx_t_1 != 0);
12229
if (__pyx_t_2) {
12230
12231
/* "sage/structure/element.pxd":64
12232
* """
12233
* if isinstance(x, Element):
12234
* return (<Element>x)._parent # <<<<<<<<<<<<<<
12235
* # Fast check for "number" types, including int and float
12236
* if PyNumber_Check(x):
12237
*/
12238
__Pyx_XDECREF(__pyx_r);
12239
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent));
12240
__pyx_r = ((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent);
12241
goto __pyx_L0;
12242
12243
/* "sage/structure/element.pxd":63
12244
* <... 'list'>
12245
* """
12246
* if isinstance(x, Element): # <<<<<<<<<<<<<<
12247
* return (<Element>x)._parent
12248
* # Fast check for "number" types, including int and float
12249
*/
12250
}
12251
12252
/* "sage/structure/element.pxd":66
12253
* return (<Element>x)._parent
12254
* # Fast check for "number" types, including int and float
12255
* if PyNumber_Check(x): # <<<<<<<<<<<<<<
12256
* return type(x)
12257
* try:
12258
*/
12259
__pyx_t_2 = (PyNumber_Check(__pyx_v_x) != 0);
12260
if (__pyx_t_2) {
12261
12262
/* "sage/structure/element.pxd":67
12263
* # Fast check for "number" types, including int and float
12264
* if PyNumber_Check(x):
12265
* return type(x) # <<<<<<<<<<<<<<
12266
* try:
12267
* p = x.parent
12268
*/
12269
__Pyx_XDECREF(__pyx_r);
12270
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
12271
__pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
12272
goto __pyx_L0;
12273
12274
/* "sage/structure/element.pxd":66
12275
* return (<Element>x)._parent
12276
* # Fast check for "number" types, including int and float
12277
* if PyNumber_Check(x): # <<<<<<<<<<<<<<
12278
* return type(x)
12279
* try:
12280
*/
12281
}
12282
12283
/* "sage/structure/element.pxd":68
12284
* if PyNumber_Check(x):
12285
* return type(x)
12286
* try: # <<<<<<<<<<<<<<
12287
* p = x.parent
12288
* except AttributeError:
12289
*/
12290
{
12291
__Pyx_PyThreadState_declare
12292
__Pyx_PyThreadState_assign
12293
__Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
12294
__Pyx_XGOTREF(__pyx_t_3);
12295
__Pyx_XGOTREF(__pyx_t_4);
12296
__Pyx_XGOTREF(__pyx_t_5);
12297
/*try:*/ {
12298
12299
/* "sage/structure/element.pxd":69
12300
* return type(x)
12301
* try:
12302
* p = x.parent # <<<<<<<<<<<<<<
12303
* except AttributeError:
12304
* return type(x)
12305
*/
12306
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_parent); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 69, __pyx_L5_error)
12307
__Pyx_GOTREF(__pyx_t_6);
12308
__pyx_v_p = __pyx_t_6;
12309
__pyx_t_6 = 0;
12310
12311
/* "sage/structure/element.pxd":68
12312
* if PyNumber_Check(x):
12313
* return type(x)
12314
* try: # <<<<<<<<<<<<<<
12315
* p = x.parent
12316
* except AttributeError:
12317
*/
12318
}
12319
12320
/* "sage/structure/element.pxd":73
12321
* return type(x)
12322
* else:
12323
* return p() # <<<<<<<<<<<<<<
12324
*
12325
*
12326
*/
12327
/*else:*/ {
12328
__Pyx_XDECREF(__pyx_r);
12329
__Pyx_INCREF(__pyx_v_p);
12330
__pyx_t_7 = __pyx_v_p; __pyx_t_8 = NULL;
12331
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
12332
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
12333
if (likely(__pyx_t_8)) {
12334
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
12335
__Pyx_INCREF(__pyx_t_8);
12336
__Pyx_INCREF(function);
12337
__Pyx_DECREF_SET(__pyx_t_7, function);
12338
}
12339
}
12340
if (__pyx_t_8) {
12341
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 73, __pyx_L7_except_error)
12342
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12343
} else {
12344
__pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 73, __pyx_L7_except_error)
12345
}
12346
__Pyx_GOTREF(__pyx_t_6);
12347
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12348
__pyx_r = __pyx_t_6;
12349
__pyx_t_6 = 0;
12350
goto __pyx_L8_except_return;
12351
}
12352
__pyx_L5_error:;
12353
__Pyx_PyThreadState_assign
12354
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12355
12356
/* "sage/structure/element.pxd":70
12357
* try:
12358
* p = x.parent
12359
* except AttributeError: # <<<<<<<<<<<<<<
12360
* return type(x)
12361
* else:
12362
*/
12363
__pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
12364
if (__pyx_t_9) {
12365
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
12366
if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(3, 70, __pyx_L7_except_error)
12367
__Pyx_GOTREF(__pyx_t_6);
12368
__Pyx_GOTREF(__pyx_t_7);
12369
__Pyx_GOTREF(__pyx_t_8);
12370
12371
/* "sage/structure/element.pxd":71
12372
* p = x.parent
12373
* except AttributeError:
12374
* return type(x) # <<<<<<<<<<<<<<
12375
* else:
12376
* return p()
12377
*/
12378
__Pyx_XDECREF(__pyx_r);
12379
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
12380
__pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
12381
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12382
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12383
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12384
goto __pyx_L8_except_return;
12385
}
12386
goto __pyx_L7_except_error;
12387
__pyx_L7_except_error:;
12388
12389
/* "sage/structure/element.pxd":68
12390
* if PyNumber_Check(x):
12391
* return type(x)
12392
* try: # <<<<<<<<<<<<<<
12393
* p = x.parent
12394
* except AttributeError:
12395
*/
12396
__Pyx_PyThreadState_assign
12397
__Pyx_XGIVEREF(__pyx_t_3);
12398
__Pyx_XGIVEREF(__pyx_t_4);
12399
__Pyx_XGIVEREF(__pyx_t_5);
12400
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12401
goto __pyx_L1_error;
12402
__pyx_L8_except_return:;
12403
__Pyx_PyThreadState_assign
12404
__Pyx_XGIVEREF(__pyx_t_3);
12405
__Pyx_XGIVEREF(__pyx_t_4);
12406
__Pyx_XGIVEREF(__pyx_t_5);
12407
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12408
goto __pyx_L0;
12409
}
12410
12411
/* "sage/structure/element.pxd":7
12412
*
12413
*
12414
* cpdef inline parent(x): # <<<<<<<<<<<<<<
12415
* """
12416
* Return the parent of the element ``x``.
12417
*/
12418
12419
/* function exit code */
12420
__pyx_L1_error:;
12421
__Pyx_XDECREF(__pyx_t_6);
12422
__Pyx_XDECREF(__pyx_t_7);
12423
__Pyx_XDECREF(__pyx_t_8);
12424
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
12425
__pyx_r = 0;
12426
__pyx_L0:;
12427
__Pyx_XDECREF(__pyx_v_p);
12428
__Pyx_XGIVEREF(__pyx_r);
12429
__Pyx_RefNannyFinishContext();
12430
return __pyx_r;
12431
}
12432
12433
/* Python wrapper */
12434
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
12435
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 ";
12436
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x) {
12437
PyObject *__pyx_r = 0;
12438
__Pyx_RefNannyDeclarations
12439
__Pyx_RefNannySetupContext("parent (wrapper)", 0);
12440
__pyx_r = __pyx_pf_4sage_9structure_7element_parent(__pyx_self, ((PyObject *)__pyx_v_x));
12441
12442
/* function exit code */
12443
__Pyx_RefNannyFinishContext();
12444
return __pyx_r;
12445
}
12446
12447
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
12448
PyObject *__pyx_r = NULL;
12449
__Pyx_RefNannyDeclarations
12450
PyObject *__pyx_t_1 = NULL;
12451
__Pyx_RefNannySetupContext("parent", 0);
12452
__Pyx_XDECREF(__pyx_r);
12453
__pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 7, __pyx_L1_error)
12454
__Pyx_GOTREF(__pyx_t_1);
12455
__pyx_r = __pyx_t_1;
12456
__pyx_t_1 = 0;
12457
goto __pyx_L0;
12458
12459
/* function exit code */
12460
__pyx_L1_error:;
12461
__Pyx_XDECREF(__pyx_t_1);
12462
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
12463
__pyx_r = NULL;
12464
__pyx_L0:;
12465
__Pyx_XGIVEREF(__pyx_r);
12466
__Pyx_RefNannyFinishContext();
12467
return __pyx_r;
12468
}
12469
12470
/* "sage/structure/element.pxd":76
12471
*
12472
*
12473
* cdef inline int classify_elements(left, right): # <<<<<<<<<<<<<<
12474
* """
12475
* Given two objects, at least one which is an :class:`Element`,
12476
*/
12477
12478
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
12479
int __pyx_r;
12480
__Pyx_RefNannyDeclarations
12481
int __pyx_t_1;
12482
int __pyx_t_2;
12483
__Pyx_RefNannySetupContext("classify_elements", 0);
12484
12485
/* "sage/structure/element.pxd":99
12486
* - 0o37: both are Element, same type, same parent
12487
* """
12488
* if type(left) is type(right): # <<<<<<<<<<<<<<
12489
* # We know at least one of the arguments is an Element. So if
12490
* # their types are *equal* (fast to check) then they are both
12491
*/
12492
__pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_left)) == ((PyObject *)Py_TYPE(__pyx_v_right)));
12493
__pyx_t_2 = (__pyx_t_1 != 0);
12494
if (__pyx_t_2) {
12495
12496
/* "sage/structure/element.pxd":103
12497
* # their types are *equal* (fast to check) then they are both
12498
* # Elements.
12499
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
12500
* return 0o37
12501
* else:
12502
*/
12503
__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);
12504
__pyx_t_1 = (__pyx_t_2 != 0);
12505
if (__pyx_t_1) {
12506
12507
/* "sage/structure/element.pxd":104
12508
* # Elements.
12509
* if (<Element>left)._parent is (<Element>right)._parent:
12510
* return 0o37 # <<<<<<<<<<<<<<
12511
* else:
12512
* return 0o17
12513
*/
12514
__pyx_r = 037;
12515
goto __pyx_L0;
12516
12517
/* "sage/structure/element.pxd":103
12518
* # their types are *equal* (fast to check) then they are both
12519
* # Elements.
12520
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
12521
* return 0o37
12522
* else:
12523
*/
12524
}
12525
12526
/* "sage/structure/element.pxd":106
12527
* return 0o37
12528
* else:
12529
* return 0o17 # <<<<<<<<<<<<<<
12530
* if not isinstance(right, Element):
12531
* return 0o01
12532
*/
12533
/*else*/ {
12534
__pyx_r = 017;
12535
goto __pyx_L0;
12536
}
12537
12538
/* "sage/structure/element.pxd":99
12539
* - 0o37: both are Element, same type, same parent
12540
* """
12541
* if type(left) is type(right): # <<<<<<<<<<<<<<
12542
* # We know at least one of the arguments is an Element. So if
12543
* # their types are *equal* (fast to check) then they are both
12544
*/
12545
}
12546
12547
/* "sage/structure/element.pxd":107
12548
* else:
12549
* return 0o17
12550
* if not isinstance(right, Element): # <<<<<<<<<<<<<<
12551
* return 0o01
12552
* if not isinstance(left, Element):
12553
*/
12554
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_right, __pyx_ptype_4sage_9structure_7element_Element);
12555
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
12556
if (__pyx_t_2) {
12557
12558
/* "sage/structure/element.pxd":108
12559
* return 0o17
12560
* if not isinstance(right, Element):
12561
* return 0o01 # <<<<<<<<<<<<<<
12562
* if not isinstance(left, Element):
12563
* return 0o02
12564
*/
12565
__pyx_r = 001;
12566
goto __pyx_L0;
12567
12568
/* "sage/structure/element.pxd":107
12569
* else:
12570
* return 0o17
12571
* if not isinstance(right, Element): # <<<<<<<<<<<<<<
12572
* return 0o01
12573
* if not isinstance(left, Element):
12574
*/
12575
}
12576
12577
/* "sage/structure/element.pxd":109
12578
* if not isinstance(right, Element):
12579
* return 0o01
12580
* if not isinstance(left, Element): # <<<<<<<<<<<<<<
12581
* return 0o02
12582
* if (<Element>left)._parent is (<Element>right)._parent:
12583
*/
12584
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_left, __pyx_ptype_4sage_9structure_7element_Element);
12585
__pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
12586
if (__pyx_t_1) {
12587
12588
/* "sage/structure/element.pxd":110
12589
* return 0o01
12590
* if not isinstance(left, Element):
12591
* return 0o02 # <<<<<<<<<<<<<<
12592
* if (<Element>left)._parent is (<Element>right)._parent:
12593
* return 0o27
12594
*/
12595
__pyx_r = 002;
12596
goto __pyx_L0;
12597
12598
/* "sage/structure/element.pxd":109
12599
* if not isinstance(right, Element):
12600
* return 0o01
12601
* if not isinstance(left, Element): # <<<<<<<<<<<<<<
12602
* return 0o02
12603
* if (<Element>left)._parent is (<Element>right)._parent:
12604
*/
12605
}
12606
12607
/* "sage/structure/element.pxd":111
12608
* if not isinstance(left, Element):
12609
* return 0o02
12610
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
12611
* return 0o27
12612
* else:
12613
*/
12614
__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);
12615
__pyx_t_2 = (__pyx_t_1 != 0);
12616
if (__pyx_t_2) {
12617
12618
/* "sage/structure/element.pxd":112
12619
* return 0o02
12620
* if (<Element>left)._parent is (<Element>right)._parent:
12621
* return 0o27 # <<<<<<<<<<<<<<
12622
* else:
12623
* return 0o07
12624
*/
12625
__pyx_r = 027;
12626
goto __pyx_L0;
12627
12628
/* "sage/structure/element.pxd":111
12629
* if not isinstance(left, Element):
12630
* return 0o02
12631
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
12632
* return 0o27
12633
* else:
12634
*/
12635
}
12636
12637
/* "sage/structure/element.pxd":114
12638
* return 0o27
12639
* else:
12640
* return 0o07 # <<<<<<<<<<<<<<
12641
*
12642
* # Functions to help understand the result of classify_elements()
12643
*/
12644
/*else*/ {
12645
__pyx_r = 007;
12646
goto __pyx_L0;
12647
}
12648
12649
/* "sage/structure/element.pxd":76
12650
*
12651
*
12652
* cdef inline int classify_elements(left, right): # <<<<<<<<<<<<<<
12653
* """
12654
* Given two objects, at least one which is an :class:`Element`,
12655
*/
12656
12657
/* function exit code */
12658
__pyx_L0:;
12659
__Pyx_RefNannyFinishContext();
12660
return __pyx_r;
12661
}
12662
12663
/* "sage/structure/element.pxd":117
12664
*
12665
* # Functions to help understand the result of classify_elements()
12666
* cdef inline bint BOTH_ARE_ELEMENT(int cl): # <<<<<<<<<<<<<<
12667
* return cl & 0o04
12668
* cdef inline bint HAVE_SAME_PARENT(int cl):
12669
*/
12670
12671
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_BOTH_ARE_ELEMENT(int __pyx_v_cl) {
12672
int __pyx_r;
12673
__Pyx_RefNannyDeclarations
12674
__Pyx_RefNannySetupContext("BOTH_ARE_ELEMENT", 0);
12675
12676
/* "sage/structure/element.pxd":118
12677
* # Functions to help understand the result of classify_elements()
12678
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
12679
* return cl & 0o04 # <<<<<<<<<<<<<<
12680
* cdef inline bint HAVE_SAME_PARENT(int cl):
12681
* return cl & 0o20
12682
*/
12683
__pyx_r = (__pyx_v_cl & 004);
12684
goto __pyx_L0;
12685
12686
/* "sage/structure/element.pxd":117
12687
*
12688
* # Functions to help understand the result of classify_elements()
12689
* cdef inline bint BOTH_ARE_ELEMENT(int cl): # <<<<<<<<<<<<<<
12690
* return cl & 0o04
12691
* cdef inline bint HAVE_SAME_PARENT(int cl):
12692
*/
12693
12694
/* function exit code */
12695
__pyx_L0:;
12696
__Pyx_RefNannyFinishContext();
12697
return __pyx_r;
12698
}
12699
12700
/* "sage/structure/element.pxd":119
12701
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
12702
* return cl & 0o04
12703
* cdef inline bint HAVE_SAME_PARENT(int cl): # <<<<<<<<<<<<<<
12704
* return cl & 0o20
12705
*
12706
*/
12707
12708
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int __pyx_v_cl) {
12709
int __pyx_r;
12710
__Pyx_RefNannyDeclarations
12711
__Pyx_RefNannySetupContext("HAVE_SAME_PARENT", 0);
12712
12713
/* "sage/structure/element.pxd":120
12714
* return cl & 0o04
12715
* cdef inline bint HAVE_SAME_PARENT(int cl):
12716
* return cl & 0o20 # <<<<<<<<<<<<<<
12717
*
12718
*
12719
*/
12720
__pyx_r = (__pyx_v_cl & 020);
12721
goto __pyx_L0;
12722
12723
/* "sage/structure/element.pxd":119
12724
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
12725
* return cl & 0o04
12726
* cdef inline bint HAVE_SAME_PARENT(int cl): # <<<<<<<<<<<<<<
12727
* return cl & 0o20
12728
*
12729
*/
12730
12731
/* function exit code */
12732
__pyx_L0:;
12733
__Pyx_RefNannyFinishContext();
12734
return __pyx_r;
12735
}
12736
12737
/* "sage/structure/element.pxd":123
12738
*
12739
*
12740
* cpdef inline bint have_same_parent(left, right): # <<<<<<<<<<<<<<
12741
* """
12742
* Return ``True`` if and only if ``left`` and ``right`` have the
12743
*/
12744
12745
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12746
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) {
12747
int __pyx_r;
12748
__Pyx_RefNannyDeclarations
12749
__Pyx_RefNannySetupContext("have_same_parent", 0);
12750
12751
/* "sage/structure/element.pxd":155
12752
* True
12753
* """
12754
* return HAVE_SAME_PARENT(classify_elements(left, right)) # <<<<<<<<<<<<<<
12755
*
12756
*
12757
*/
12758
__pyx_r = __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(__pyx_f_4sage_9structure_7element_classify_elements(__pyx_v_left, __pyx_v_right));
12759
goto __pyx_L0;
12760
12761
/* "sage/structure/element.pxd":123
12762
*
12763
*
12764
* cpdef inline bint have_same_parent(left, right): # <<<<<<<<<<<<<<
12765
* """
12766
* Return ``True`` if and only if ``left`` and ``right`` have the
12767
*/
12768
12769
/* function exit code */
12770
__pyx_L0:;
12771
__Pyx_RefNannyFinishContext();
12772
return __pyx_r;
12773
}
12774
12775
/* Python wrapper */
12776
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12777
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 ";
12778
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12779
PyObject *__pyx_v_left = 0;
12780
PyObject *__pyx_v_right = 0;
12781
PyObject *__pyx_r = 0;
12782
__Pyx_RefNannyDeclarations
12783
__Pyx_RefNannySetupContext("have_same_parent (wrapper)", 0);
12784
{
12785
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left,&__pyx_n_s_right,0};
12786
PyObject* values[2] = {0,0};
12787
if (unlikely(__pyx_kwds)) {
12788
Py_ssize_t kw_args;
12789
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12790
switch (pos_args) {
12791
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12792
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12793
case 0: break;
12794
default: goto __pyx_L5_argtuple_error;
12795
}
12796
kw_args = PyDict_Size(__pyx_kwds);
12797
switch (pos_args) {
12798
case 0:
12799
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
12800
else goto __pyx_L5_argtuple_error;
12801
case 1:
12802
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
12803
else {
12804
__Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, 1); __PYX_ERR(3, 123, __pyx_L3_error)
12805
}
12806
}
12807
if (unlikely(kw_args > 0)) {
12808
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "have_same_parent") < 0)) __PYX_ERR(3, 123, __pyx_L3_error)
12809
}
12810
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
12811
goto __pyx_L5_argtuple_error;
12812
} else {
12813
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12814
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12815
}
12816
__pyx_v_left = values[0];
12817
__pyx_v_right = values[1];
12818
}
12819
goto __pyx_L4_argument_unpacking_done;
12820
__pyx_L5_argtuple_error:;
12821
__Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 123, __pyx_L3_error)
12822
__pyx_L3_error:;
12823
__Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
12824
__Pyx_RefNannyFinishContext();
12825
return NULL;
12826
__pyx_L4_argument_unpacking_done:;
12827
__pyx_r = __pyx_pf_4sage_9structure_7element_2have_same_parent(__pyx_self, __pyx_v_left, __pyx_v_right);
12828
12829
/* function exit code */
12830
__Pyx_RefNannyFinishContext();
12831
return __pyx_r;
12832
}
12833
12834
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
12835
PyObject *__pyx_r = NULL;
12836
__Pyx_RefNannyDeclarations
12837
PyObject *__pyx_t_1 = NULL;
12838
__Pyx_RefNannySetupContext("have_same_parent", 0);
12839
__Pyx_XDECREF(__pyx_r);
12840
__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(3, 123, __pyx_L1_error)
12841
__Pyx_GOTREF(__pyx_t_1);
12842
__pyx_r = __pyx_t_1;
12843
__pyx_t_1 = 0;
12844
goto __pyx_L0;
12845
12846
/* function exit code */
12847
__pyx_L1_error:;
12848
__Pyx_XDECREF(__pyx_t_1);
12849
__Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
12850
__pyx_r = NULL;
12851
__pyx_L0:;
12852
__Pyx_XGIVEREF(__pyx_r);
12853
__Pyx_RefNannyFinishContext();
12854
return __pyx_r;
12855
}
12856
12857
/* "sage/structure/element.pxd":158
12858
*
12859
*
12860
* cdef inline parent_c(x): # <<<<<<<<<<<<<<
12861
* """
12862
* Deprecated alias for :func:`parent`.
12863
*/
12864
12865
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent_c(PyObject *__pyx_v_x) {
12866
PyObject *__pyx_r = NULL;
12867
__Pyx_RefNannyDeclarations
12868
PyObject *__pyx_t_1 = NULL;
12869
__Pyx_RefNannySetupContext("parent_c", 0);
12870
12871
/* "sage/structure/element.pxd":162
12872
* Deprecated alias for :func:`parent`.
12873
* """
12874
* return parent(x) # <<<<<<<<<<<<<<
12875
*
12876
*
12877
*/
12878
__Pyx_XDECREF(__pyx_r);
12879
__pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 162, __pyx_L1_error)
12880
__Pyx_GOTREF(__pyx_t_1);
12881
__pyx_r = __pyx_t_1;
12882
__pyx_t_1 = 0;
12883
goto __pyx_L0;
12884
12885
/* "sage/structure/element.pxd":158
12886
*
12887
*
12888
* cdef inline parent_c(x): # <<<<<<<<<<<<<<
12889
* """
12890
* Deprecated alias for :func:`parent`.
12891
*/
12892
12893
/* function exit code */
12894
__pyx_L1_error:;
12895
__Pyx_XDECREF(__pyx_t_1);
12896
__Pyx_AddTraceback("sage.structure.element.parent_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
12897
__pyx_r = 0;
12898
__pyx_L0:;
12899
__Pyx_XGIVEREF(__pyx_r);
12900
__Pyx_RefNannyFinishContext();
12901
return __pyx_r;
12902
}
12903
12904
/* "sage/ext/stdsage.pxd":16
12905
*
12906
*
12907
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
12908
* """
12909
* Return ``t.__new__(t)``. This works even for types like
12910
*/
12911
12912
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *__pyx_v_t) {
12913
PyObject *__pyx_r = NULL;
12914
__Pyx_RefNannyDeclarations
12915
PyObject *__pyx_t_1 = NULL;
12916
__Pyx_RefNannySetupContext("PY_NEW", 0);
12917
12918
/* "sage/ext/stdsage.pxd":22
12919
* optimizations assume that ``tp_new`` doesn't change).
12920
* """
12921
* return (<PyTypeObject*>t).tp_new(t, <object>NULL, <object>NULL) # <<<<<<<<<<<<<<
12922
*
12923
*
12924
*/
12925
__Pyx_XDECREF(__pyx_r);
12926
__pyx_t_1 = ((PyTypeObject *)__pyx_v_t)->tp_new(((PyTypeObject *)__pyx_v_t), ((PyObject *)NULL), ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22, __pyx_L1_error)
12927
__Pyx_GOTREF(__pyx_t_1);
12928
__pyx_r = __pyx_t_1;
12929
__pyx_t_1 = 0;
12930
goto __pyx_L0;
12931
12932
/* "sage/ext/stdsage.pxd":16
12933
*
12934
*
12935
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
12936
* """
12937
* Return ``t.__new__(t)``. This works even for types like
12938
*/
12939
12940
/* function exit code */
12941
__pyx_L1_error:;
12942
__Pyx_XDECREF(__pyx_t_1);
12943
__Pyx_AddTraceback("sage.ext.stdsage.PY_NEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
12944
__pyx_r = 0;
12945
__pyx_L0:;
12946
__Pyx_XGIVEREF(__pyx_r);
12947
__Pyx_RefNannyFinishContext();
12948
return __pyx_r;
12949
}
12950
12951
/* "sage/ext/stdsage.pxd":25
12952
*
12953
*
12954
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
12955
* """
12956
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
12957
*/
12958
12959
static CYTHON_INLINE void __pyx_f_4sage_3ext_7stdsage_PY_SET_TP_NEW(PyTypeObject *__pyx_v_dst, PyTypeObject *__pyx_v_src) {
12960
__Pyx_RefNannyDeclarations
12961
newfunc __pyx_t_1;
12962
__Pyx_RefNannySetupContext("PY_SET_TP_NEW", 0);
12963
12964
/* "sage/ext/stdsage.pxd":31
12965
* irrelevant base class ``tp_new`` methods.
12966
* """
12967
* (<PyTypeObject*>dst).tp_new = (<PyTypeObject*>src).tp_new # <<<<<<<<<<<<<<
12968
*
12969
*
12970
*/
12971
__pyx_t_1 = ((PyTypeObject *)__pyx_v_src)->tp_new;
12972
((PyTypeObject *)__pyx_v_dst)->tp_new = __pyx_t_1;
12973
12974
/* "sage/ext/stdsage.pxd":25
12975
*
12976
*
12977
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
12978
* """
12979
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
12980
*/
12981
12982
/* function exit code */
12983
__Pyx_RefNannyFinishContext();
12984
}
12985
12986
/* "sage/ext/stdsage.pxd":34
12987
*
12988
*
12989
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
12990
* """
12991
* Test whether the given object has a Python dictionary.
12992
*/
12993
12994
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *__pyx_v_obj) {
12995
int __pyx_r;
12996
__Pyx_RefNannyDeclarations
12997
__Pyx_RefNannySetupContext("HAS_DICTIONARY", 0);
12998
12999
/* "sage/ext/stdsage.pxd":38
13000
* Test whether the given object has a Python dictionary.
13001
* """
13002
* return Py_TYPE(obj).tp_dictoffset != 0 # <<<<<<<<<<<<<<
13003
*/
13004
__pyx_r = (Py_TYPE(__pyx_v_obj)->tp_dictoffset != 0);
13005
goto __pyx_L0;
13006
13007
/* "sage/ext/stdsage.pxd":34
13008
*
13009
*
13010
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
13011
* """
13012
* Test whether the given object has a Python dictionary.
13013
*/
13014
13015
/* function exit code */
13016
__pyx_L0:;
13017
__Pyx_RefNannyFinishContext();
13018
return __pyx_r;
13019
}
13020
13021
/* "cysignals/signals.pxd":35
13022
* # (PyErr_Occurred() is non-NULL). To Cython, it will look like
13023
* # cython_check_exception() actually raised the exception.
13024
* cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<<
13025
* pass
13026
*
13027
*/
13028
13029
static CYTHON_INLINE void __pyx_f_9cysignals_7signals_cython_check_exception(void) {
13030
13031
/* function exit code */
13032
}
13033
13034
/* "cfunc.to_py":65
13035
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
13036
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
13037
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
13038
* """wrap(arg0, arg1, arg2: 'int')"""
13039
* return f(arg0, arg1, arg2)
13040
*/
13041
13042
/* Python wrapper */
13043
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*/
13044
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')";
13045
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};
13046
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) {
13047
PyObject *__pyx_v_arg0 = 0;
13048
PyObject *__pyx_v_arg1 = 0;
13049
int __pyx_v_arg2;
13050
PyObject *__pyx_r = 0;
13051
__Pyx_RefNannyDeclarations
13052
__Pyx_RefNannySetupContext("wrap (wrapper)", 0);
13053
{
13054
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg0,&__pyx_n_s_arg1,&__pyx_n_s_arg2,0};
13055
PyObject* values[3] = {0,0,0};
13056
if (unlikely(__pyx_kwds)) {
13057
Py_ssize_t kw_args;
13058
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13059
switch (pos_args) {
13060
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13061
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13062
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13063
case 0: break;
13064
default: goto __pyx_L5_argtuple_error;
13065
}
13066
kw_args = PyDict_Size(__pyx_kwds);
13067
switch (pos_args) {
13068
case 0:
13069
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg0)) != 0)) kw_args--;
13070
else goto __pyx_L5_argtuple_error;
13071
case 1:
13072
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg1)) != 0)) kw_args--;
13073
else {
13074
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, 1); __PYX_ERR(5, 65, __pyx_L3_error)
13075
}
13076
case 2:
13077
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg2)) != 0)) kw_args--;
13078
else {
13079
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, 2); __PYX_ERR(5, 65, __pyx_L3_error)
13080
}
13081
}
13082
if (unlikely(kw_args > 0)) {
13083
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(5, 65, __pyx_L3_error)
13084
}
13085
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
13086
goto __pyx_L5_argtuple_error;
13087
} else {
13088
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13089
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13090
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13091
}
13092
__pyx_v_arg0 = values[0];
13093
__pyx_v_arg1 = values[1];
13094
__pyx_v_arg2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_arg2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 65, __pyx_L3_error)
13095
}
13096
goto __pyx_L4_argument_unpacking_done;
13097
__pyx_L5_argtuple_error:;
13098
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 65, __pyx_L3_error)
13099
__pyx_L3_error:;
13100
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
13101
__Pyx_RefNannyFinishContext();
13102
return NULL;
13103
__pyx_L4_argument_unpacking_done:;
13104
__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);
13105
13106
/* function exit code */
13107
__Pyx_RefNannyFinishContext();
13108
return __pyx_r;
13109
}
13110
13111
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) {
13112
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_cur_scope;
13113
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_outer_scope;
13114
PyObject *__pyx_r = NULL;
13115
__Pyx_RefNannyDeclarations
13116
PyObject *__pyx_t_1 = NULL;
13117
__Pyx_RefNannySetupContext("wrap", 0);
13118
__pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self);
13119
__pyx_cur_scope = __pyx_outer_scope;
13120
13121
/* "cfunc.to_py":67
13122
* def wrap(object arg0, object arg1, int arg2):
13123
* """wrap(arg0, arg1, arg2: 'int')"""
13124
* return f(arg0, arg1, arg2) # <<<<<<<<<<<<<<
13125
* return wrap
13126
*
13127
*/
13128
__Pyx_XDECREF(__pyx_r);
13129
__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(5, 67, __pyx_L1_error)
13130
__Pyx_GOTREF(__pyx_t_1);
13131
__pyx_r = __pyx_t_1;
13132
__pyx_t_1 = 0;
13133
goto __pyx_L0;
13134
13135
/* "cfunc.to_py":65
13136
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
13137
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
13138
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
13139
* """wrap(arg0, arg1, arg2: 'int')"""
13140
* return f(arg0, arg1, arg2)
13141
*/
13142
13143
/* function exit code */
13144
__pyx_L1_error:;
13145
__Pyx_XDECREF(__pyx_t_1);
13146
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
13147
__pyx_r = NULL;
13148
__pyx_L0:;
13149
__Pyx_XGIVEREF(__pyx_r);
13150
__Pyx_RefNannyFinishContext();
13151
return __pyx_r;
13152
}
13153
13154
/* "cfunc.to_py":64
13155
*
13156
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
13157
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
13158
* def wrap(object arg0, object arg1, int arg2):
13159
* """wrap(arg0, arg1, arg2: 'int')"""
13160
*/
13161
13162
static PyObject *__Pyx_CFunc_object____object____object____int___to_py(PyObject *(*__pyx_v_f)(PyObject *, PyObject *, int)) {
13163
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_cur_scope;
13164
PyObject *__pyx_v_wrap = 0;
13165
PyObject *__pyx_r = NULL;
13166
__Pyx_RefNannyDeclarations
13167
PyObject *__pyx_t_1 = NULL;
13168
__Pyx_RefNannySetupContext("__Pyx_CFunc_object____object____object____int___to_py", 0);
13169
__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);
13170
if (unlikely(!__pyx_cur_scope)) {
13171
__pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)Py_None);
13172
__Pyx_INCREF(Py_None);
13173
__PYX_ERR(5, 64, __pyx_L1_error)
13174
} else {
13175
__Pyx_GOTREF(__pyx_cur_scope);
13176
}
13177
__pyx_cur_scope->__pyx_v_f = __pyx_v_f;
13178
13179
/* "cfunc.to_py":65
13180
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
13181
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
13182
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
13183
* """wrap(arg0, arg1, arg2: 'int')"""
13184
* return f(arg0, arg1, arg2)
13185
*/
13186
__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(5, 65, __pyx_L1_error)
13187
__Pyx_GOTREF(__pyx_t_1);
13188
__pyx_v_wrap = __pyx_t_1;
13189
__pyx_t_1 = 0;
13190
13191
/* "cfunc.to_py":68
13192
* """wrap(arg0, arg1, arg2: 'int')"""
13193
* return f(arg0, arg1, arg2)
13194
* return wrap # <<<<<<<<<<<<<<
13195
*
13196
*
13197
*/
13198
__Pyx_XDECREF(__pyx_r);
13199
__Pyx_INCREF(__pyx_v_wrap);
13200
__pyx_r = __pyx_v_wrap;
13201
goto __pyx_L0;
13202
13203
/* "cfunc.to_py":64
13204
*
13205
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
13206
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
13207
* def wrap(object arg0, object arg1, int arg2):
13208
* """wrap(arg0, arg1, arg2: 'int')"""
13209
*/
13210
13211
/* function exit code */
13212
__pyx_L1_error:;
13213
__Pyx_XDECREF(__pyx_t_1);
13214
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
13215
__pyx_r = 0;
13216
__pyx_L0:;
13217
__Pyx_XDECREF(__pyx_v_wrap);
13218
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
13219
__Pyx_XGIVEREF(__pyx_r);
13220
__Pyx_RefNannyFinishContext();
13221
return __pyx_r;
13222
}
13223
13224
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
13225
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *p;
13226
PyObject *o;
13227
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
13228
o = (*t->tp_alloc)(t, 0);
13229
} else {
13230
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
13231
}
13232
if (unlikely(!o)) return 0;
13233
p = ((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)o);
13234
p->E = Py_None; Py_INCREF(Py_None);
13235
p->j = Py_None; Py_INCREF(Py_None);
13236
p->c_quo = Py_None; Py_INCREF(Py_None);
13237
if (unlikely(__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
13238
return o;
13239
bad:
13240
Py_DECREF(o); o = 0;
13241
return NULL;
13242
}
13243
13244
static void __pyx_tp_dealloc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius(PyObject *o) {
13245
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)o;
13246
#if PY_VERSION_HEX >= 0x030400a1
13247
if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
13248
if (PyObject_CallFinalizerFromDealloc(o)) return;
13249
}
13250
#endif
13251
PyObject_GC_UnTrack(o);
13252
{
13253
PyObject *etype, *eval, *etb;
13254
PyErr_Fetch(&etype, &eval, &etb);
13255
++Py_REFCNT(o);
13256
__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_9__dealloc__(o);
13257
--Py_REFCNT(o);
13258
PyErr_Restore(etype, eval, etb);
13259
}
13260
Py_CLEAR(p->E);
13261
Py_CLEAR(p->j);
13262
Py_CLEAR(p->c_quo);
13263
(*Py_TYPE(o)->tp_free)(o);
13264
}
13265
13266
static int __pyx_tp_traverse_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius(PyObject *o, visitproc v, void *a) {
13267
int e;
13268
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)o;
13269
if (p->E) {
13270
e = (*v)(p->E, a); if (e) return e;
13271
}
13272
if (p->j) {
13273
e = (*v)(p->j, a); if (e) return e;
13274
}
13275
if (p->c_quo) {
13276
e = (*v)(p->c_quo, a); if (e) return e;
13277
}
13278
return 0;
13279
}
13280
13281
static int __pyx_tp_clear_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius(PyObject *o) {
13282
PyObject* tmp;
13283
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius *)o;
13284
tmp = ((PyObject*)p->E);
13285
p->E = Py_None; Py_INCREF(Py_None);
13286
Py_XDECREF(tmp);
13287
tmp = ((PyObject*)p->j);
13288
p->j = Py_None; Py_INCREF(Py_None);
13289
Py_XDECREF(tmp);
13290
tmp = ((PyObject*)p->c_quo);
13291
p->c_quo = Py_None; Py_INCREF(Py_None);
13292
Py_XDECREF(tmp);
13293
return 0;
13294
}
13295
13296
static PyMethodDef __pyx_methods_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius[] = {
13297
{"_initialize_prime_ap_tables", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_5_initialize_prime_ap_tables, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_4_initialize_prime_ap_tables},
13298
{"_initialize_coefficients", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_7_initialize_coefficients, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_6_initialize_coefficients},
13299
{"_tables", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_11_tables, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_10_tables},
13300
{"aplist", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_13aplist, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_12aplist},
13301
{"_compute_split_traces", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_15_compute_split_traces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_14_compute_split_traces},
13302
{"_compute_inert_and_ramified_traces", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_17_compute_inert_and_ramified_traces, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_16_compute_inert_and_ramified_traces},
13303
{"_compute_remaining_traces_naively", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_19_compute_remaining_traces_naively, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_18_compute_remaining_traces_naively},
13304
{"_compute_naive_trace", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_21_compute_naive_trace, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_20_compute_naive_trace},
13305
{"prime", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_23prime, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_22prime},
13306
{"_compute_traces", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_25_compute_traces, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_24_compute_traces},
13307
{0, 0, 0, 0}
13308
};
13309
13310
static PyTypeObject __pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius = {
13311
PyVarObject_HEAD_INIT(0, 0)
13312
"code.alex.psage.psage.ellcurve.lseries.sqrt5.TracesOfFrobenius", /*tp_name*/
13313
sizeof(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius), /*tp_basicsize*/
13314
0, /*tp_itemsize*/
13315
__pyx_tp_dealloc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius, /*tp_dealloc*/
13316
0, /*tp_print*/
13317
0, /*tp_getattr*/
13318
0, /*tp_setattr*/
13319
#if PY_MAJOR_VERSION < 3
13320
0, /*tp_compare*/
13321
#endif
13322
#if PY_MAJOR_VERSION >= 3
13323
0, /*tp_as_async*/
13324
#endif
13325
0, /*tp_repr*/
13326
0, /*tp_as_number*/
13327
0, /*tp_as_sequence*/
13328
0, /*tp_as_mapping*/
13329
0, /*tp_hash*/
13330
0, /*tp_call*/
13331
0, /*tp_str*/
13332
0, /*tp_getattro*/
13333
0, /*tp_setattro*/
13334
0, /*tp_as_buffer*/
13335
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
13336
0, /*tp_doc*/
13337
__pyx_tp_traverse_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius, /*tp_traverse*/
13338
__pyx_tp_clear_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius, /*tp_clear*/
13339
0, /*tp_richcompare*/
13340
0, /*tp_weaklistoffset*/
13341
0, /*tp_iter*/
13342
0, /*tp_iternext*/
13343
__pyx_methods_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius, /*tp_methods*/
13344
0, /*tp_members*/
13345
0, /*tp_getset*/
13346
0, /*tp_base*/
13347
0, /*tp_dict*/
13348
0, /*tp_descr_get*/
13349
0, /*tp_descr_set*/
13350
0, /*tp_dictoffset*/
13351
__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_3__init__, /*tp_init*/
13352
0, /*tp_alloc*/
13353
__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius, /*tp_new*/
13354
0, /*tp_free*/
13355
0, /*tp_is_gc*/
13356
0, /*tp_bases*/
13357
0, /*tp_mro*/
13358
0, /*tp_cache*/
13359
0, /*tp_subclasses*/
13360
0, /*tp_weaklist*/
13361
0, /*tp_del*/
13362
0, /*tp_version_tag*/
13363
#if PY_VERSION_HEX >= 0x030400a1
13364
0, /*tp_finalize*/
13365
#endif
13366
};
13367
static struct __pyx_vtabstruct_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator __pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator;
13368
13369
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
13370
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *p;
13371
PyObject *o;
13372
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
13373
o = (*t->tp_alloc)(t, 0);
13374
} else {
13375
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
13376
}
13377
if (unlikely(!o)) return 0;
13378
p = ((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)o);
13379
p->__pyx_vtab = __pyx_vtabptr_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator;
13380
p->tables = ((PyObject*)Py_None); Py_INCREF(Py_None);
13381
return o;
13382
}
13383
13384
static void __pyx_tp_dealloc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator(PyObject *o) {
13385
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)o;
13386
#if PY_VERSION_HEX >= 0x030400a1
13387
if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
13388
if (PyObject_CallFinalizerFromDealloc(o)) return;
13389
}
13390
#endif
13391
PyObject_GC_UnTrack(o);
13392
Py_CLEAR(p->tables);
13393
(*Py_TYPE(o)->tp_free)(o);
13394
}
13395
13396
static int __pyx_tp_traverse_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator(PyObject *o, visitproc v, void *a) {
13397
int e;
13398
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)o;
13399
if (p->tables) {
13400
e = (*v)(p->tables, a); if (e) return e;
13401
}
13402
return 0;
13403
}
13404
13405
static int __pyx_tp_clear_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator(PyObject *o) {
13406
PyObject* tmp;
13407
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *)o;
13408
tmp = ((PyObject*)p->tables);
13409
p->tables = ((PyObject*)Py_None); Py_INCREF(Py_None);
13410
Py_XDECREF(tmp);
13411
return 0;
13412
}
13413
13414
static PyObject *__pyx_getprop_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_tables(PyObject *o, CYTHON_UNUSED void *x) {
13415
return __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_1__get__(o);
13416
}
13417
13418
static int __pyx_setprop_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_tables(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
13419
if (v) {
13420
return __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_3__set__(o, v);
13421
}
13422
else {
13423
return __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6tables_5__del__(o);
13424
}
13425
}
13426
13427
static PyMethodDef __pyx_methods_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator[] = {
13428
{"__reduce__", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_5__reduce__, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_4__reduce__},
13429
{"trace_of_frobenius", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_7trace_of_frobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_6trace_of_frobenius},
13430
{"init_table", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_9init_table, METH_O, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_8init_table},
13431
{0, 0, 0, 0}
13432
};
13433
13434
static struct PyGetSetDef __pyx_getsets_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator[] = {
13435
{(char *)"tables", __pyx_getprop_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_tables, __pyx_setprop_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_tables, (char *)"File: sqrt5.pyx (starting at line 366)", 0},
13436
{0, 0, 0, 0, 0}
13437
};
13438
13439
static PyTypeObject __pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator = {
13440
PyVarObject_HEAD_INIT(0, 0)
13441
"code.alex.psage.psage.ellcurve.lseries.sqrt5.InertTraceCalculator", /*tp_name*/
13442
sizeof(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator), /*tp_basicsize*/
13443
0, /*tp_itemsize*/
13444
__pyx_tp_dealloc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, /*tp_dealloc*/
13445
0, /*tp_print*/
13446
0, /*tp_getattr*/
13447
0, /*tp_setattr*/
13448
#if PY_MAJOR_VERSION < 3
13449
0, /*tp_compare*/
13450
#endif
13451
#if PY_MAJOR_VERSION >= 3
13452
0, /*tp_as_async*/
13453
#endif
13454
__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_3__repr__, /*tp_repr*/
13455
0, /*tp_as_number*/
13456
0, /*tp_as_sequence*/
13457
0, /*tp_as_mapping*/
13458
0, /*tp_hash*/
13459
0, /*tp_call*/
13460
0, /*tp_str*/
13461
0, /*tp_getattro*/
13462
0, /*tp_setattro*/
13463
0, /*tp_as_buffer*/
13464
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
13465
0, /*tp_doc*/
13466
__pyx_tp_traverse_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, /*tp_traverse*/
13467
__pyx_tp_clear_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, /*tp_clear*/
13468
0, /*tp_richcompare*/
13469
0, /*tp_weaklistoffset*/
13470
0, /*tp_iter*/
13471
0, /*tp_iternext*/
13472
__pyx_methods_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, /*tp_methods*/
13473
0, /*tp_members*/
13474
__pyx_getsets_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, /*tp_getset*/
13475
0, /*tp_base*/
13476
0, /*tp_dict*/
13477
0, /*tp_descr_get*/
13478
0, /*tp_descr_set*/
13479
0, /*tp_dictoffset*/
13480
__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_1__init__, /*tp_init*/
13481
0, /*tp_alloc*/
13482
__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, /*tp_new*/
13483
0, /*tp_free*/
13484
0, /*tp_is_gc*/
13485
0, /*tp_bases*/
13486
0, /*tp_mro*/
13487
0, /*tp_cache*/
13488
0, /*tp_subclasses*/
13489
0, /*tp_weaklist*/
13490
0, /*tp_del*/
13491
0, /*tp_version_tag*/
13492
#if PY_VERSION_HEX >= 0x030400a1
13493
0, /*tp_finalize*/
13494
#endif
13495
};
13496
13497
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];
13498
static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = 0;
13499
13500
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) {
13501
PyObject *o;
13502
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)))) {
13503
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];
13504
memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py));
13505
(void) PyObject_INIT(o, t);
13506
} else {
13507
o = (*t->tp_alloc)(t, 0);
13508
if (unlikely(!o)) return 0;
13509
}
13510
return o;
13511
}
13512
13513
static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyObject *o) {
13514
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)))) {
13515
__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);
13516
} else {
13517
(*Py_TYPE(o)->tp_free)(o);
13518
}
13519
}
13520
13521
static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = {
13522
PyVarObject_HEAD_INIT(0, 0)
13523
"code.alex.psage.psage.ellcurve.lseries.sqrt5.__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py", /*tp_name*/
13524
sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py), /*tp_basicsize*/
13525
0, /*tp_itemsize*/
13526
__pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, /*tp_dealloc*/
13527
0, /*tp_print*/
13528
0, /*tp_getattr*/
13529
0, /*tp_setattr*/
13530
#if PY_MAJOR_VERSION < 3
13531
0, /*tp_compare*/
13532
#endif
13533
#if PY_MAJOR_VERSION >= 3
13534
0, /*tp_as_async*/
13535
#endif
13536
0, /*tp_repr*/
13537
0, /*tp_as_number*/
13538
0, /*tp_as_sequence*/
13539
0, /*tp_as_mapping*/
13540
0, /*tp_hash*/
13541
0, /*tp_call*/
13542
0, /*tp_str*/
13543
0, /*tp_getattro*/
13544
0, /*tp_setattro*/
13545
0, /*tp_as_buffer*/
13546
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
13547
0, /*tp_doc*/
13548
0, /*tp_traverse*/
13549
0, /*tp_clear*/
13550
0, /*tp_richcompare*/
13551
0, /*tp_weaklistoffset*/
13552
0, /*tp_iter*/
13553
0, /*tp_iternext*/
13554
0, /*tp_methods*/
13555
0, /*tp_members*/
13556
0, /*tp_getset*/
13557
0, /*tp_base*/
13558
0, /*tp_dict*/
13559
0, /*tp_descr_get*/
13560
0, /*tp_descr_set*/
13561
0, /*tp_dictoffset*/
13562
0, /*tp_init*/
13563
0, /*tp_alloc*/
13564
__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, /*tp_new*/
13565
0, /*tp_free*/
13566
0, /*tp_is_gc*/
13567
0, /*tp_bases*/
13568
0, /*tp_mro*/
13569
0, /*tp_cache*/
13570
0, /*tp_subclasses*/
13571
0, /*tp_weaklist*/
13572
0, /*tp_del*/
13573
0, /*tp_version_tag*/
13574
#if PY_VERSION_HEX >= 0x030400a1
13575
0, /*tp_finalize*/
13576
#endif
13577
};
13578
13579
static PyMethodDef __pyx_methods[] = {
13580
{"ap_via_enumeration", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_1ap_via_enumeration, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_ap_via_enumeration},
13581
{"sqrt_mod", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_3sqrt_mod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_2sqrt_mod},
13582
{0, 0, 0, 0}
13583
};
13584
13585
#if PY_MAJOR_VERSION >= 3
13586
static struct PyModuleDef __pyx_moduledef = {
13587
#if PY_VERSION_HEX < 0x03020000
13588
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
13589
#else
13590
PyModuleDef_HEAD_INIT,
13591
#endif
13592
"sqrt5",
13593
__pyx_k_File_sqrt5_pyx_starting_at_line, /* m_doc */
13594
-1, /* m_size */
13595
__pyx_methods /* m_methods */,
13596
NULL, /* m_reload */
13597
NULL, /* m_traverse */
13598
NULL, /* m_clear */
13599
NULL /* m_free */
13600
};
13601
#endif
13602
13603
static __Pyx_StringTabEntry __pyx_string_tab[] = {
13604
{&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
13605
{&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
13606
{&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
13607
{&__pyx_n_s_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 0, 1, 1},
13608
{&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
13609
{&__pyx_kp_s_Inert_trace_calculator_with_prec, __pyx_k_Inert_trace_calculator_with_prec, sizeof(__pyx_k_Inert_trace_calculator_with_prec), 0, 0, 1, 0},
13610
{&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
13611
{&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
13612
{&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
13613
{&__pyx_n_s_Pyx_CFunc_object____object, __pyx_k_Pyx_CFunc_object____object, sizeof(__pyx_k_Pyx_CFunc_object____object), 0, 0, 1, 1},
13614
{&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1},
13615
{&__pyx_n_s_ResidueRing, __pyx_k_ResidueRing, sizeof(__pyx_k_ResidueRing), 0, 0, 1, 1},
13616
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
13617
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
13618
{&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
13619
{&__pyx_n_s_a4, __pyx_k_a4, sizeof(__pyx_k_a4), 0, 0, 1, 1},
13620
{&__pyx_n_s_a6, __pyx_k_a6, sizeof(__pyx_k_a6), 0, 0, 1, 1},
13621
{&__pyx_n_s_a_invariants, __pyx_k_a_invariants, sizeof(__pyx_k_a_invariants), 0, 0, 1, 1},
13622
{&__pyx_n_s_algorithm, __pyx_k_algorithm, sizeof(__pyx_k_algorithm), 0, 0, 1, 1},
13623
{&__pyx_n_s_ap, __pyx_k_ap, sizeof(__pyx_k_ap), 0, 0, 1, 1},
13624
{&__pyx_n_s_aplist, __pyx_k_aplist, sizeof(__pyx_k_aplist), 0, 0, 1, 1},
13625
{&__pyx_n_s_arg0, __pyx_k_arg0, sizeof(__pyx_k_arg0), 0, 0, 1, 1},
13626
{&__pyx_n_s_arg1, __pyx_k_arg1, sizeof(__pyx_k_arg1), 0, 0, 1, 1},
13627
{&__pyx_n_s_arg2, __pyx_k_arg2, sizeof(__pyx_k_arg2), 0, 0, 1, 1},
13628
{&__pyx_n_s_bound, __pyx_k_bound, sizeof(__pyx_k_bound), 0, 0, 1, 1},
13629
{&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
13630
{&__pyx_n_s_c_quo, __pyx_k_c_quo, sizeof(__pyx_k_c_quo), 0, 0, 1, 1},
13631
{&__pyx_n_s_c_quo0, __pyx_k_c_quo0, sizeof(__pyx_k_c_quo0), 0, 0, 1, 1},
13632
{&__pyx_n_s_cfunc_to_py, __pyx_k_cfunc_to_py, sizeof(__pyx_k_cfunc_to_py), 0, 0, 1, 1},
13633
{&__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},
13634
{&__pyx_n_s_compute_inert_and_ramified_trac, __pyx_k_compute_inert_and_ramified_trac, sizeof(__pyx_k_compute_inert_and_ramified_trac), 0, 0, 1, 1},
13635
{&__pyx_n_s_compute_naive_trace, __pyx_k_compute_naive_trace, sizeof(__pyx_k_compute_naive_trace), 0, 0, 1, 1},
13636
{&__pyx_n_s_compute_remaining_traces_naivel, __pyx_k_compute_remaining_traces_naivel, sizeof(__pyx_k_compute_remaining_traces_naivel), 0, 0, 1, 1},
13637
{&__pyx_n_s_compute_split_traces, __pyx_k_compute_split_traces, sizeof(__pyx_k_compute_split_traces), 0, 0, 1, 1},
13638
{&__pyx_n_s_deprecation, __pyx_k_deprecation, sizeof(__pyx_k_deprecation), 0, 0, 1, 1},
13639
{&__pyx_kp_s_ellap_ellinit_0_0_0_s_s_1_s, __pyx_k_ellap_ellinit_0_0_0_s_s_1_s, sizeof(__pyx_k_ellap_ellinit_0_0_0_s_s_1_s), 0, 0, 1, 0},
13640
{&__pyx_n_s_elliptic_curve_ap, __pyx_k_elliptic_curve_ap, sizeof(__pyx_k_elliptic_curve_ap), 0, 0, 1, 1},
13641
{&__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_k_failed_to_allocate_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_bytes), 0, 0, 1, 0},
13642
{&__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_k_failed_to_allocate_s_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_s_bytes), 0, 0, 1, 0},
13643
{&__pyx_n_s_gen, __pyx_k_gen, sizeof(__pyx_k_gen), 0, 0, 1, 1},
13644
{&__pyx_n_s_get_verbose, __pyx_k_get_verbose, sizeof(__pyx_k_get_verbose), 0, 0, 1, 1},
13645
{&__pyx_kp_s_i_must_be_between_0_and_s, __pyx_k_i_must_be_between_0_and_s, sizeof(__pyx_k_i_must_be_between_0_and_s), 0, 0, 1, 0},
13646
{&__pyx_n_s_ideal, __pyx_k_ideal, sizeof(__pyx_k_ideal), 0, 0, 1, 1},
13647
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
13648
{&__pyx_kp_s_import_cysignals_signals_pxi_ins, __pyx_k_import_cysignals_signals_pxi_ins, sizeof(__pyx_k_import_cysignals_signals_pxi_ins), 0, 0, 1, 0},
13649
{&__pyx_n_s_inert_primes, __pyx_k_inert_primes, sizeof(__pyx_k_inert_primes), 0, 0, 1, 1},
13650
{&__pyx_n_s_inert_table, __pyx_k_inert_table, sizeof(__pyx_k_inert_table), 0, 0, 1, 1},
13651
{&__pyx_n_s_init_memory_functions, __pyx_k_init_memory_functions, sizeof(__pyx_k_init_memory_functions), 0, 0, 1, 1},
13652
{&__pyx_n_s_initialize_coefficients, __pyx_k_initialize_coefficients, sizeof(__pyx_k_initialize_coefficients), 0, 0, 1, 1},
13653
{&__pyx_n_s_initialize_prime_ap_tables, __pyx_k_initialize_prime_ap_tables, sizeof(__pyx_k_initialize_prime_ap_tables), 0, 0, 1, 1},
13654
{&__pyx_n_s_j0, __pyx_k_j0, sizeof(__pyx_k_j0), 0, 0, 1, 1},
13655
{&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
13656
{&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
13657
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
13658
{&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
13659
{&__pyx_kp_s_memory_assumption_violated, __pyx_k_memory_assumption_violated, sizeof(__pyx_k_memory_assumption_violated), 0, 0, 1, 0},
13660
{&__pyx_kp_s_naive_i_s_a__s, __pyx_k_naive_i_s_a__s, sizeof(__pyx_k_naive_i_s_a__s), 0, 0, 1, 0},
13661
{&__pyx_n_s_op, __pyx_k_op, sizeof(__pyx_k_op), 0, 0, 1, 1},
13662
{&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
13663
{&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
13664
{&__pyx_n_s_pari, __pyx_k_pari, sizeof(__pyx_k_pari), 0, 0, 1, 1},
13665
{&__pyx_n_s_parts, __pyx_k_parts, sizeof(__pyx_k_parts), 0, 0, 1, 1},
13666
{&__pyx_n_s_prime, __pyx_k_prime, sizeof(__pyx_k_prime), 0, 0, 1, 1},
13667
{&__pyx_n_s_prime_pi, __pyx_k_prime_pi, sizeof(__pyx_k_prime_pi), 0, 0, 1, 1},
13668
{&__pyx_n_s_prime_range, __pyx_k_prime_range, sizeof(__pyx_k_prime_range), 0, 0, 1, 1},
13669
{&__pyx_n_s_primes, __pyx_k_primes, sizeof(__pyx_k_primes), 0, 0, 1, 1},
13670
{&__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},
13671
{&__pyx_n_s_psage_libs_smalljac_wrapper1, __pyx_k_psage_libs_smalljac_wrapper1, sizeof(__pyx_k_psage_libs_smalljac_wrapper1), 0, 0, 1, 1},
13672
{&__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},
13673
{&__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt_2, __pyx_k_psage_modform_hilbert_sqrt5_sqrt_2, sizeof(__pyx_k_psage_modform_hilbert_sqrt5_sqrt_2), 0, 0, 1, 1},
13674
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
13675
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
13676
{&__pyx_kp_s_residue_ring_must_be_a_field, __pyx_k_residue_ring_must_be_a_field, sizeof(__pyx_k_residue_ring_must_be_a_field), 0, 0, 1, 0},
13677
{&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
13678
{&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
13679
{&__pyx_n_s_sage_all, __pyx_k_sage_all, sizeof(__pyx_k_sage_all), 0, 0, 1, 1},
13680
{&__pyx_n_s_sage_ext_memory, __pyx_k_sage_ext_memory, sizeof(__pyx_k_sage_ext_memory), 0, 0, 1, 1},
13681
{&__pyx_n_s_sage_misc_superseded, __pyx_k_sage_misc_superseded, sizeof(__pyx_k_sage_misc_superseded), 0, 0, 1, 1},
13682
{&__pyx_kp_s_skipping_inert_table_computation, __pyx_k_skipping_inert_table_computation, sizeof(__pyx_k_skipping_inert_table_computation), 0, 0, 1, 0},
13683
{&__pyx_n_s_smalljac, __pyx_k_smalljac, sizeof(__pyx_k_smalljac), 0, 0, 1, 1},
13684
{&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
13685
{&__pyx_n_s_sqrt5, __pyx_k_sqrt5, sizeof(__pyx_k_sqrt5), 0, 0, 1, 1},
13686
{&__pyx_n_s_squares, __pyx_k_squares, sizeof(__pyx_k_squares), 0, 0, 1, 1},
13687
{&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
13688
{&__pyx_n_s_tables, __pyx_k_tables, sizeof(__pyx_k_tables), 0, 0, 1, 1},
13689
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
13690
{&__pyx_n_s_trace_of_frobenius, __pyx_k_trace_of_frobenius, sizeof(__pyx_k_trace_of_frobenius), 0, 0, 1, 1},
13691
{&__pyx_n_s_unpickle_InertTraceCalculator, __pyx_k_unpickle_InertTraceCalculator, sizeof(__pyx_k_unpickle_InertTraceCalculator), 0, 0, 1, 1},
13692
{&__pyx_n_s_verbose, __pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 0, 1, 1},
13693
{&__pyx_n_s_wrap, __pyx_k_wrap, sizeof(__pyx_k_wrap), 0, 0, 1, 1},
13694
{&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
13695
{&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
13696
{0, 0, 0, 0, 0, 0, 0}
13697
};
13698
static int __Pyx_InitCachedBuiltins(void) {
13699
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 81, __pyx_L1_error)
13700
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 86, __pyx_L1_error)
13701
__pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 158, __pyx_L1_error)
13702
__pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 316, __pyx_L1_error)
13703
__pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 382, __pyx_L1_error)
13704
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 91, __pyx_L1_error)
13705
__pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(3, 70, __pyx_L1_error)
13706
return 0;
13707
__pyx_L1_error:;
13708
return -1;
13709
}
13710
13711
static int __Pyx_InitCachedConstants(void) {
13712
__Pyx_RefNannyDeclarations
13713
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
13714
13715
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":355
13716
* """
13717
* from math import sqrt
13718
* s = set([Integer(2), Integer(3)]) # <<<<<<<<<<<<<<
13719
* return [p for p in prime_range(int(sqrt(N))) if p%5 in s]
13720
*
13721
*/
13722
__pyx_tuple_ = PyTuple_Pack(1, __pyx_int_2); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 355, __pyx_L1_error)
13723
__Pyx_GOTREF(__pyx_tuple_);
13724
__Pyx_GIVEREF(__pyx_tuple_);
13725
__pyx_tuple__2 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 355, __pyx_L1_error)
13726
__Pyx_GOTREF(__pyx_tuple__2);
13727
__Pyx_GIVEREF(__pyx_tuple__2);
13728
13729
/* "cfunc.to_py":65
13730
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
13731
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
13732
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
13733
* """wrap(arg0, arg1, arg2: 'int')"""
13734
* return f(arg0, arg1, arg2)
13735
*/
13736
__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(5, 65, __pyx_L1_error)
13737
__Pyx_GOTREF(__pyx_tuple__3);
13738
__Pyx_GIVEREF(__pyx_tuple__3);
13739
__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(5, 65, __pyx_L1_error)
13740
13741
/* "../../../../../../../sage/sage-7.5/src/sage/ext/interrupt.pxi":2
13742
* from sage.misc.superseded import deprecation
13743
* deprecation(20002, '''import "cysignals/signals.pxi" instead of "sage/ext/interrupt.pxi"''') # <<<<<<<<<<<<<<
13744
*
13745
* include "cysignals/signals.pxi"
13746
*/
13747
__pyx_tuple__5 = PyTuple_Pack(2, __pyx_int_20002, __pyx_kp_s_import_cysignals_signals_pxi_ins); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(31, 2, __pyx_L1_error)
13748
__Pyx_GOTREF(__pyx_tuple__5);
13749
__Pyx_GIVEREF(__pyx_tuple__5);
13750
13751
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":339
13752
* ###############################################################
13753
*
13754
* def inert_primes(N): # <<<<<<<<<<<<<<
13755
* r"""
13756
* Return a list of the inert primes of `\QQ(\sqrt{5})` of norm less than `N`.
13757
*/
13758
__pyx_tuple__6 = PyTuple_Pack(4, __pyx_n_s_N, __pyx_n_s_sqrt, __pyx_n_s_s, __pyx_n_s_p); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 339, __pyx_L1_error)
13759
__Pyx_GOTREF(__pyx_tuple__6);
13760
__Pyx_GIVEREF(__pyx_tuple__6);
13761
__pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_inert_primes, 339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 339, __pyx_L1_error)
13762
13763
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":360
13764
* from sage.stats.intlist cimport IntList
13765
*
13766
* def unpickle_InertTraceCalculator(tables): # <<<<<<<<<<<<<<
13767
* C = InertTraceCalculator()
13768
* C.tables = tables
13769
*/
13770
__pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_tables, __pyx_n_s_C); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 360, __pyx_L1_error)
13771
__Pyx_GOTREF(__pyx_tuple__8);
13772
__Pyx_GIVEREF(__pyx_tuple__8);
13773
__pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_unpickle_InertTraceCalculator, 360, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 360, __pyx_L1_error)
13774
__Pyx_RefNannyFinishContext();
13775
return 0;
13776
__pyx_L1_error:;
13777
__Pyx_RefNannyFinishContext();
13778
return -1;
13779
}
13780
13781
static int __Pyx_InitGlobals(void) {
13782
__pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
13783
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
13784
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
13785
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
13786
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
13787
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
13788
__pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
13789
__pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
13790
__pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
13791
__pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
13792
__pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) __PYX_ERR(0, 1, __pyx_L1_error)
13793
__pyx_int_36 = PyInt_FromLong(36); if (unlikely(!__pyx_int_36)) __PYX_ERR(0, 1, __pyx_L1_error)
13794
__pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error)
13795
__pyx_int_216 = PyInt_FromLong(216); if (unlikely(!__pyx_int_216)) __PYX_ERR(0, 1, __pyx_L1_error)
13796
__pyx_int_432 = PyInt_FromLong(432); if (unlikely(!__pyx_int_432)) __PYX_ERR(0, 1, __pyx_L1_error)
13797
__pyx_int_20002 = PyInt_FromLong(20002L); if (unlikely(!__pyx_int_20002)) __PYX_ERR(0, 1, __pyx_L1_error)
13798
__pyx_int_neg_27 = PyInt_FromLong(-27); if (unlikely(!__pyx_int_neg_27)) __PYX_ERR(0, 1, __pyx_L1_error)
13799
__pyx_int_neg_48 = PyInt_FromLong(-48); if (unlikely(!__pyx_int_neg_48)) __PYX_ERR(0, 1, __pyx_L1_error)
13800
__pyx_int_neg_54 = PyInt_FromLong(-54); if (unlikely(!__pyx_int_neg_54)) __PYX_ERR(0, 1, __pyx_L1_error)
13801
__pyx_int_neg_64 = PyInt_FromLong(-64); if (unlikely(!__pyx_int_neg_64)) __PYX_ERR(0, 1, __pyx_L1_error)
13802
__pyx_int_neg_864 = PyInt_FromLong(-864); if (unlikely(!__pyx_int_neg_864)) __PYX_ERR(0, 1, __pyx_L1_error)
13803
__pyx_int_neg_110592 = PyInt_FromLong(-110592L); if (unlikely(!__pyx_int_neg_110592)) __PYX_ERR(0, 1, __pyx_L1_error)
13804
return 0;
13805
__pyx_L1_error:;
13806
return -1;
13807
}
13808
13809
#if PY_MAJOR_VERSION < 3
13810
PyMODINIT_FUNC initsqrt5(void); /*proto*/
13811
PyMODINIT_FUNC initsqrt5(void)
13812
#else
13813
PyMODINIT_FUNC PyInit_sqrt5(void); /*proto*/
13814
PyMODINIT_FUNC PyInit_sqrt5(void)
13815
#endif
13816
{
13817
PyObject *__pyx_t_1 = NULL;
13818
PyObject *__pyx_t_2 = NULL;
13819
PyObject *__pyx_t_3 = NULL;
13820
PyObject *__pyx_t_4 = NULL;
13821
int __pyx_t_5;
13822
__Pyx_RefNannyDeclarations
13823
#if CYTHON_REFNANNY
13824
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
13825
if (!__Pyx_RefNanny) {
13826
PyErr_Clear();
13827
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
13828
if (!__Pyx_RefNanny)
13829
Py_FatalError("failed to import 'refnanny' module");
13830
}
13831
#endif
13832
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sqrt5(void)", 0);
13833
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13834
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
13835
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
13836
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
13837
#ifdef __Pyx_CyFunction_USED
13838
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13839
#endif
13840
#ifdef __Pyx_FusedFunction_USED
13841
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13842
#endif
13843
#ifdef __Pyx_Coroutine_USED
13844
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13845
#endif
13846
#ifdef __Pyx_Generator_USED
13847
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13848
#endif
13849
#ifdef __Pyx_StopAsyncIteration_USED
13850
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13851
#endif
13852
/*--- Library function declarations ---*/
13853
/*--- Threads initialization code ---*/
13854
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
13855
#ifdef WITH_THREAD /* Python build with threading support? */
13856
PyEval_InitThreads();
13857
#endif
13858
#endif
13859
/*--- Module creation code ---*/
13860
#if PY_MAJOR_VERSION < 3
13861
__pyx_m = Py_InitModule4("sqrt5", __pyx_methods, __pyx_k_File_sqrt5_pyx_starting_at_line, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
13862
#else
13863
__pyx_m = PyModule_Create(&__pyx_moduledef);
13864
#endif
13865
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
13866
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
13867
Py_INCREF(__pyx_d);
13868
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
13869
#if CYTHON_COMPILING_IN_PYPY
13870
Py_INCREF(__pyx_b);
13871
#endif
13872
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
13873
/*--- Initialize various global constants etc. ---*/
13874
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13875
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
13876
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13877
#endif
13878
if (__pyx_module_is_main_code__alex__psage__psage__ellcurve__lseries__sqrt5) {
13879
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13880
}
13881
#if PY_MAJOR_VERSION >= 3
13882
{
13883
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
13884
if (!PyDict_GetItemString(modules, "code.alex.psage.psage.ellcurve.lseries.sqrt5")) {
13885
if (unlikely(PyDict_SetItemString(modules, "code.alex.psage.psage.ellcurve.lseries.sqrt5", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
13886
}
13887
}
13888
#endif
13889
/*--- Builtin init code ---*/
13890
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13891
/*--- Constants init code ---*/
13892
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
13893
/*--- Global init code ---*/
13894
/*--- Variable export code ---*/
13895
/*--- Function export code ---*/
13896
/*--- Type init code ---*/
13897
if (PyType_Ready(&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
13898
__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius.tp_print = 0;
13899
#if CYTHON_COMPILING_IN_CPYTHON
13900
{
13901
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 123, __pyx_L1_error)
13902
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
13903
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
13904
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__.doc = __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__;
13905
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_17TracesOfFrobenius_2__init__;
13906
}
13907
}
13908
#endif
13909
if (PyObject_SetAttrString(__pyx_m, "TracesOfFrobenius", (PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
13910
__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius = &__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_TracesOfFrobenius;
13911
__pyx_vtabptr_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator = &__pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator;
13912
__pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.trace_of_frobenius = (long (*)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, PyObject *, PyObject *, long, int __pyx_skip_dispatch))__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_trace_of_frobenius;
13913
__pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.cube_table = (int (*)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, struct __pyx_obj_4sage_5stats_7intlist_IntList *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *))__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_cube_table;
13914
__pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.init_squares_table = (int (*)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, struct __pyx_obj_4sage_5stats_7intlist_IntList *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *))__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_init_squares_table;
13915
__pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.elliptic_curve_from_j = (int (*)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, long *, long *, long *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *))__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_elliptic_curve_from_j;
13916
__pyx_vtable_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.ap_via_enumeration = (int (*)(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator *, int *, int *, long *, long *, struct __pyx_obj_5psage_7modform_7hilbert_5sqrt5_10sqrt5_fast_ResidueRing_abstract *, struct __pyx_obj_4sage_5stats_7intlist_IntList *, struct __pyx_obj_4sage_5stats_7intlist_IntList *))__pyx_f_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_ap_via_enumeration;
13917
if (PyType_Ready(&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
13918
__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.tp_print = 0;
13919
#if CYTHON_COMPILING_IN_CPYTHON
13920
{
13921
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 365, __pyx_L1_error)
13922
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
13923
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
13924
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__.doc = __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__;
13925
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator___init__;
13926
}
13927
}
13928
#endif
13929
#if CYTHON_COMPILING_IN_CPYTHON
13930
{
13931
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 365, __pyx_L1_error)
13932
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
13933
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
13934
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__.doc = __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__;
13935
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_20InertTraceCalculator_2__repr__;
13936
}
13937
}
13938
#endif
13939
if (__Pyx_SetVtable(__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator.tp_dict, __pyx_vtabptr_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
13940
if (PyObject_SetAttrString(__pyx_m, "InertTraceCalculator", (PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
13941
__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator = &__pyx_type_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_InertTraceCalculator;
13942
if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py) < 0) __PYX_ERR(5, 64, __pyx_L1_error)
13943
__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py.tp_print = 0;
13944
__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = &__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py;
13945
/*--- Type import code ---*/
13946
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
13947
#if CYTHON_COMPILING_IN_PYPY
13948
sizeof(PyTypeObject),
13949
#else
13950
sizeof(PyHeapTypeObject),
13951
#endif
13952
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(6, 9, __pyx_L1_error)
13953
__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(7, 8, __pyx_L1_error)
13954
__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(8, 15, __pyx_L1_error)
13955
__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)
13956
__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(9, 15, __pyx_L1_error)
13957
__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(9, 15, __pyx_L1_error)
13958
__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(10, 7, __pyx_L1_error)
13959
__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(10, 7, __pyx_L1_error)
13960
__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(10, 23, __pyx_L1_error)
13961
__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(10, 23, __pyx_L1_error)
13962
__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(11, 3, __pyx_L1_error)
13963
__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(3, 169, __pyx_L1_error)
13964
__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(3, 169, __pyx_L1_error)
13965
__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(3, 192, __pyx_L1_error)
13966
__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(3, 192, __pyx_L1_error)
13967
__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(3, 195, __pyx_L1_error)
13968
__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(3, 195, __pyx_L1_error)
13969
__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(3, 197, __pyx_L1_error)
13970
__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(3, 197, __pyx_L1_error)
13971
__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(3, 208, __pyx_L1_error)
13972
__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(3, 208, __pyx_L1_error)
13973
__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(3, 211, __pyx_L1_error)
13974
__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(3, 211, __pyx_L1_error)
13975
__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(3, 214, __pyx_L1_error)
13976
__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(3, 214, __pyx_L1_error)
13977
__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(3, 220, __pyx_L1_error)
13978
__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(3, 220, __pyx_L1_error)
13979
__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(3, 223, __pyx_L1_error)
13980
__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(3, 223, __pyx_L1_error)
13981
__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(3, 226, __pyx_L1_error)
13982
__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(3, 226, __pyx_L1_error)
13983
__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(3, 229, __pyx_L1_error)
13984
__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(3, 229, __pyx_L1_error)
13985
__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(3, 232, __pyx_L1_error)
13986
__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(3, 232, __pyx_L1_error)
13987
__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(3, 236, __pyx_L1_error)
13988
__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(3, 236, __pyx_L1_error)
13989
__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(3, 239, __pyx_L1_error)
13990
__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(3, 239, __pyx_L1_error)
13991
__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(3, 242, __pyx_L1_error)
13992
__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(3, 242, __pyx_L1_error)
13993
__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(3, 245, __pyx_L1_error)
13994
__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(3, 245, __pyx_L1_error)
13995
__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(3, 249, __pyx_L1_error)
13996
__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(3, 249, __pyx_L1_error)
13997
__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(3, 264, __pyx_L1_error)
13998
__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(3, 264, __pyx_L1_error)
13999
__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(3, 277, __pyx_L1_error)
14000
__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(3, 277, __pyx_L1_error)
14001
__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(12, 12, __pyx_L1_error)
14002
__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(12, 12, __pyx_L1_error)
14003
__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(13, 15, __pyx_L1_error)
14004
__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(13, 15, __pyx_L1_error)
14005
__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(14, 11, __pyx_L1_error)
14006
__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(14, 11, __pyx_L1_error)
14007
__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(15, 18, __pyx_L1_error)
14008
__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(15, 18, __pyx_L1_error)
14009
__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(16, 5, __pyx_L1_error)
14010
__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(16, 5, __pyx_L1_error)
14011
__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(16, 13, __pyx_L1_error)
14012
__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(16, 13, __pyx_L1_error)
14013
__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(16, 16, __pyx_L1_error)
14014
__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(16, 16, __pyx_L1_error)
14015
__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(16, 19, __pyx_L1_error)
14016
__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(16, 19, __pyx_L1_error)
14017
__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(16, 23, __pyx_L1_error)
14018
__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(16, 23, __pyx_L1_error)
14019
__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(16, 26, __pyx_L1_error)
14020
__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(16, 26, __pyx_L1_error)
14021
__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(16, 29, __pyx_L1_error)
14022
__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(16, 29, __pyx_L1_error)
14023
__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(16, 32, __pyx_L1_error)
14024
__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(16, 32, __pyx_L1_error)
14025
__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(16, 35, __pyx_L1_error)
14026
__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(16, 35, __pyx_L1_error)
14027
__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(17, 4, __pyx_L1_error)
14028
__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(17, 4, __pyx_L1_error)
14029
__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(17, 25, __pyx_L1_error)
14030
__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(17, 25, __pyx_L1_error)
14031
__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(17, 28, __pyx_L1_error)
14032
__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(17, 28, __pyx_L1_error)
14033
__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(18, 5, __pyx_L1_error)
14034
__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(18, 5, __pyx_L1_error)
14035
__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(18, 8, __pyx_L1_error)
14036
__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(18, 8, __pyx_L1_error)
14037
__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(19, 7, __pyx_L1_error)
14038
__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(19, 7, __pyx_L1_error)
14039
__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(19, 37, __pyx_L1_error)
14040
__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(19, 37, __pyx_L1_error)
14041
__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(20, 27, __pyx_L1_error)
14042
__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(21, 5, __pyx_L1_error)
14043
__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(21, 5, __pyx_L1_error)
14044
__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(21, 7, __pyx_L1_error)
14045
__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(21, 7, __pyx_L1_error)
14046
__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(21, 24, __pyx_L1_error)
14047
__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(21, 24, __pyx_L1_error)
14048
__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(21, 28, __pyx_L1_error)
14049
__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(21, 28, __pyx_L1_error)
14050
__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(21, 31, __pyx_L1_error)
14051
__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(21, 31, __pyx_L1_error)
14052
__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(21, 34, __pyx_L1_error)
14053
__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(21, 34, __pyx_L1_error)
14054
__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(21, 38, __pyx_L1_error)
14055
__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(21, 38, __pyx_L1_error)
14056
__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(21, 41, __pyx_L1_error)
14057
__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(21, 41, __pyx_L1_error)
14058
__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(21, 44, __pyx_L1_error)
14059
__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(21, 44, __pyx_L1_error)
14060
__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(21, 48, __pyx_L1_error)
14061
__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(21, 48, __pyx_L1_error)
14062
__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(21, 51, __pyx_L1_error)
14063
__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(21, 51, __pyx_L1_error)
14064
__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(21, 54, __pyx_L1_error)
14065
__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(21, 54, __pyx_L1_error)
14066
__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(21, 57, __pyx_L1_error)
14067
__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(21, 57, __pyx_L1_error)
14068
__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(22, 8, __pyx_L1_error)
14069
__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(22, 8, __pyx_L1_error)
14070
__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(22, 29, __pyx_L1_error)
14071
__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(22, 29, __pyx_L1_error)
14072
__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(22, 34, __pyx_L1_error)
14073
__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(22, 34, __pyx_L1_error)
14074
__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(23, 3, __pyx_L1_error)
14075
__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(23, 3, __pyx_L1_error)
14076
__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(24, 3, __pyx_L1_error)
14077
__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(24, 3, __pyx_L1_error)
14078
__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(25, 11, __pyx_L1_error)
14079
__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(25, 11, __pyx_L1_error)
14080
__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(25, 38, __pyx_L1_error)
14081
__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(25, 38, __pyx_L1_error)
14082
__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(25, 41, __pyx_L1_error)
14083
__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(25, 41, __pyx_L1_error)
14084
__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(25, 46, __pyx_L1_error)
14085
__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(25, 46, __pyx_L1_error)
14086
__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(25, 49, __pyx_L1_error)
14087
__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(25, 49, __pyx_L1_error)
14088
__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(26, 6, __pyx_L1_error)
14089
__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(26, 6, __pyx_L1_error)
14090
__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(26, 19, __pyx_L1_error)
14091
__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(26, 19, __pyx_L1_error)
14092
__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(27, 7, __pyx_L1_error)
14093
__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(27, 7, __pyx_L1_error)
14094
__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(27, 9, __pyx_L1_error)
14095
__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(27, 9, __pyx_L1_error)
14096
__pyx_ptype_4sage_5stats_7intlist_IntList = __Pyx_ImportType("sage.stats.intlist", "IntList", sizeof(struct __pyx_obj_4sage_5stats_7intlist_IntList), 1); if (unlikely(!__pyx_ptype_4sage_5stats_7intlist_IntList)) __PYX_ERR(28, 8, __pyx_L1_error)
14097
__pyx_vtabptr_4sage_5stats_7intlist_IntList = (struct __pyx_vtabstruct_4sage_5stats_7intlist_IntList*)__Pyx_GetVtable(__pyx_ptype_4sage_5stats_7intlist_IntList->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5stats_7intlist_IntList)) __PYX_ERR(28, 8, __pyx_L1_error)
14098
/*--- Variable import code ---*/
14099
__pyx_t_1 = __Pyx_ImportModule("sage.structure.element"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
14100
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)
14101
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14102
__pyx_t_2 = __Pyx_ImportModule("cysignals.signals"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error)
14103
if (__Pyx_ImportVoidPtr(__pyx_t_2, "cysigs", (void **)&__pyx_vp_9cysignals_7signals_cysigs, "cysigs_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
14104
Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14105
/*--- Function import code ---*/
14106
/*--- Execution code ---*/
14107
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
14108
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
14109
#endif
14110
14111
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":54
14112
* )
14113
*
14114
* from psage.modform.hilbert.sqrt5.sqrt5_fast import ResidueRing # <<<<<<<<<<<<<<
14115
*
14116
* cpdef long ap_via_enumeration(ResidueRingElement a4, ResidueRingElement a6) except -1:
14117
*/
14118
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
14119
__Pyx_GOTREF(__pyx_t_3);
14120
__Pyx_INCREF(__pyx_n_s_ResidueRing);
14121
__Pyx_GIVEREF(__pyx_n_s_ResidueRing);
14122
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_ResidueRing);
14123
__pyx_t_4 = __Pyx_Import(__pyx_n_s_psage_modform_hilbert_sqrt5_sqrt_2, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
14124
__Pyx_GOTREF(__pyx_t_4);
14125
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14126
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_ResidueRing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
14127
__Pyx_GOTREF(__pyx_t_3);
14128
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ResidueRing, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
14129
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14130
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14131
14132
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":112
14133
* from sage.rings.integer cimport Integer
14134
*
14135
* from sage.all import prime_range, pari, verbose, get_verbose, prime_pi # <<<<<<<<<<<<<<
14136
*
14137
* from psage.libs.smalljac.wrapper1 import elliptic_curve_ap
14138
*/
14139
__pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
14140
__Pyx_GOTREF(__pyx_t_4);
14141
__Pyx_INCREF(__pyx_n_s_prime_range);
14142
__Pyx_GIVEREF(__pyx_n_s_prime_range);
14143
PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_prime_range);
14144
__Pyx_INCREF(__pyx_n_s_pari);
14145
__Pyx_GIVEREF(__pyx_n_s_pari);
14146
PyList_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_pari);
14147
__Pyx_INCREF(__pyx_n_s_verbose);
14148
__Pyx_GIVEREF(__pyx_n_s_verbose);
14149
PyList_SET_ITEM(__pyx_t_4, 2, __pyx_n_s_verbose);
14150
__Pyx_INCREF(__pyx_n_s_get_verbose);
14151
__Pyx_GIVEREF(__pyx_n_s_get_verbose);
14152
PyList_SET_ITEM(__pyx_t_4, 3, __pyx_n_s_get_verbose);
14153
__Pyx_INCREF(__pyx_n_s_prime_pi);
14154
__Pyx_GIVEREF(__pyx_n_s_prime_pi);
14155
PyList_SET_ITEM(__pyx_t_4, 4, __pyx_n_s_prime_pi);
14156
__pyx_t_3 = __Pyx_Import(__pyx_n_s_sage_all, __pyx_t_4, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
14157
__Pyx_GOTREF(__pyx_t_3);
14158
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14159
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_prime_range); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
14160
__Pyx_GOTREF(__pyx_t_4);
14161
if (PyDict_SetItem(__pyx_d, __pyx_n_s_prime_range, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
14162
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14163
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pari); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
14164
__Pyx_GOTREF(__pyx_t_4);
14165
if (PyDict_SetItem(__pyx_d, __pyx_n_s_pari, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
14166
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14167
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_verbose); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
14168
__Pyx_GOTREF(__pyx_t_4);
14169
if (PyDict_SetItem(__pyx_d, __pyx_n_s_verbose, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
14170
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14171
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_get_verbose); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
14172
__Pyx_GOTREF(__pyx_t_4);
14173
if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_verbose, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
14174
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14175
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_prime_pi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
14176
__Pyx_GOTREF(__pyx_t_4);
14177
if (PyDict_SetItem(__pyx_d, __pyx_n_s_prime_pi, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
14178
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14179
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14180
14181
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":114
14182
* from sage.all import prime_range, pari, verbose, get_verbose, prime_pi
14183
*
14184
* from psage.libs.smalljac.wrapper1 import elliptic_curve_ap # <<<<<<<<<<<<<<
14185
*
14186
* import aplist
14187
*/
14188
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
14189
__Pyx_GOTREF(__pyx_t_3);
14190
__Pyx_INCREF(__pyx_n_s_elliptic_curve_ap);
14191
__Pyx_GIVEREF(__pyx_n_s_elliptic_curve_ap);
14192
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_elliptic_curve_ap);
14193
__pyx_t_4 = __Pyx_Import(__pyx_n_s_psage_libs_smalljac_wrapper1, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error)
14194
__Pyx_GOTREF(__pyx_t_4);
14195
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14196
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_elliptic_curve_ap); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
14197
__Pyx_GOTREF(__pyx_t_3);
14198
if (PyDict_SetItem(__pyx_d, __pyx_n_s_elliptic_curve_ap, __pyx_t_3) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
14199
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14200
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14201
14202
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":116
14203
* from psage.libs.smalljac.wrapper1 import elliptic_curve_ap
14204
*
14205
* import aplist # <<<<<<<<<<<<<<
14206
*
14207
* include "stdsage.pxi"
14208
*/
14209
__pyx_t_4 = __Pyx_Import(__pyx_n_s_aplist, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
14210
__Pyx_GOTREF(__pyx_t_4);
14211
if (PyDict_SetItem(__pyx_d, __pyx_n_s_aplist, __pyx_t_4) < 0) __PYX_ERR(0, 116, __pyx_L1_error)
14212
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14213
14214
/* "../../../../../../../sage/sage-7.5/local/lib/python2.7/site-packages/cysignals/signals.pxi":24
14215
* # This *must* be done for every module using interrupt functions
14216
* # otherwise you will get segmentation faults.
14217
* import_cysignals__signals() # <<<<<<<<<<<<<<
14218
*/
14219
__pyx_t_5 = import_cysignals__signals(); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 24, __pyx_L1_error)
14220
14221
/* "../../../../../../../sage/sage-7.5/src/sage/ext/stdsage.pxi":24
14222
*
14223
* from sage.ext.stdsage cimport PY_NEW, HAS_DICTIONARY
14224
* from sage.ext.memory import init_memory_functions # <<<<<<<<<<<<<<
14225
*/
14226
__pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 24, __pyx_L1_error)
14227
__Pyx_GOTREF(__pyx_t_4);
14228
__Pyx_INCREF(__pyx_n_s_init_memory_functions);
14229
__Pyx_GIVEREF(__pyx_n_s_init_memory_functions);
14230
PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_init_memory_functions);
14231
__pyx_t_3 = __Pyx_Import(__pyx_n_s_sage_ext_memory, __pyx_t_4, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(30, 24, __pyx_L1_error)
14232
__Pyx_GOTREF(__pyx_t_3);
14233
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14234
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_init_memory_functions); if (unlikely(!__pyx_t_4)) __PYX_ERR(30, 24, __pyx_L1_error)
14235
__Pyx_GOTREF(__pyx_t_4);
14236
if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_memory_functions, __pyx_t_4) < 0) __PYX_ERR(30, 24, __pyx_L1_error)
14237
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14238
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14239
14240
/* "../../../../../../../sage/sage-7.5/src/sage/ext/interrupt.pxi":1
14241
* from sage.misc.superseded import deprecation # <<<<<<<<<<<<<<
14242
* deprecation(20002, '''import "cysignals/signals.pxi" instead of "sage/ext/interrupt.pxi"''')
14243
*
14244
*/
14245
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(31, 1, __pyx_L1_error)
14246
__Pyx_GOTREF(__pyx_t_3);
14247
__Pyx_INCREF(__pyx_n_s_deprecation);
14248
__Pyx_GIVEREF(__pyx_n_s_deprecation);
14249
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_deprecation);
14250
__pyx_t_4 = __Pyx_Import(__pyx_n_s_sage_misc_superseded, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(31, 1, __pyx_L1_error)
14251
__Pyx_GOTREF(__pyx_t_4);
14252
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14253
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_deprecation); if (unlikely(!__pyx_t_3)) __PYX_ERR(31, 1, __pyx_L1_error)
14254
__Pyx_GOTREF(__pyx_t_3);
14255
if (PyDict_SetItem(__pyx_d, __pyx_n_s_deprecation, __pyx_t_3) < 0) __PYX_ERR(31, 1, __pyx_L1_error)
14256
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14257
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14258
14259
/* "../../../../../../../sage/sage-7.5/src/sage/ext/interrupt.pxi":2
14260
* from sage.misc.superseded import deprecation
14261
* deprecation(20002, '''import "cysignals/signals.pxi" instead of "sage/ext/interrupt.pxi"''') # <<<<<<<<<<<<<<
14262
*
14263
* include "cysignals/signals.pxi"
14264
*/
14265
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_deprecation); if (unlikely(!__pyx_t_4)) __PYX_ERR(31, 2, __pyx_L1_error)
14266
__Pyx_GOTREF(__pyx_t_4);
14267
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(31, 2, __pyx_L1_error)
14268
__Pyx_GOTREF(__pyx_t_3);
14269
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14270
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14271
14272
/* "../../../../../../../sage/sage-7.5/local/lib/python2.7/site-packages/cysignals/signals.pxi":24
14273
* # This *must* be done for every module using interrupt functions
14274
* # otherwise you will get segmentation faults.
14275
* import_cysignals__signals() # <<<<<<<<<<<<<<
14276
*/
14277
__pyx_t_5 = import_cysignals__signals(); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(29, 24, __pyx_L1_error)
14278
14279
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":121
14280
* include "interrupt.pxi"
14281
*
14282
* cdef long UNKNOWN = 2**31 - 1 # <<<<<<<<<<<<<<
14283
*
14284
* cdef class TracesOfFrobenius:
14285
*/
14286
__pyx_v_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_UNKNOWN = 0x7FFFFFFF;
14287
14288
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":339
14289
* ###############################################################
14290
*
14291
* def inert_primes(N): # <<<<<<<<<<<<<<
14292
* r"""
14293
* Return a list of the inert primes of `\QQ(\sqrt{5})` of norm less than `N`.
14294
*/
14295
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_5inert_primes, NULL, __pyx_n_s_code_alex_psage_psage_ellcurve_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error)
14296
__Pyx_GOTREF(__pyx_t_3);
14297
if (PyDict_SetItem(__pyx_d, __pyx_n_s_inert_primes, __pyx_t_3) < 0) __PYX_ERR(0, 339, __pyx_L1_error)
14298
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14299
14300
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":360
14301
* from sage.stats.intlist cimport IntList
14302
*
14303
* def unpickle_InertTraceCalculator(tables): # <<<<<<<<<<<<<<
14304
* C = InertTraceCalculator()
14305
* C.tables = tables
14306
*/
14307
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4code_4alex_5psage_5psage_8ellcurve_7lseries_5sqrt5_7unpickle_InertTraceCalculator, NULL, __pyx_n_s_code_alex_psage_psage_ellcurve_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
14308
__Pyx_GOTREF(__pyx_t_3);
14309
if (PyDict_SetItem(__pyx_d, __pyx_n_s_unpickle_InertTraceCalculator, __pyx_t_3) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
14310
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14311
14312
/* "code/alex/psage/psage/ellcurve/lseries/sqrt5.pyx":1
14313
* ################################################################################# # <<<<<<<<<<<<<<
14314
* #
14315
* # (c) Copyright 2011 William Stein
14316
*/
14317
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
14318
__Pyx_GOTREF(__pyx_t_3);
14319
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
14320
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14321
14322
/* "cfunc.to_py":64
14323
*
14324
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
14325
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
14326
* def wrap(object arg0, object arg1, int arg2):
14327
* """wrap(arg0, arg1, arg2: 'int')"""
14328
*/
14329
14330
/*--- Wrapped vars code ---*/
14331
14332
goto __pyx_L0;
14333
__pyx_L1_error:;
14334
__Pyx_XDECREF(__pyx_t_1);
14335
__Pyx_XDECREF(__pyx_t_2);
14336
__Pyx_XDECREF(__pyx_t_3);
14337
__Pyx_XDECREF(__pyx_t_4);
14338
if (__pyx_m) {
14339
if (__pyx_d) {
14340
__Pyx_AddTraceback("init code.alex.psage.psage.ellcurve.lseries.sqrt5", __pyx_clineno, __pyx_lineno, __pyx_filename);
14341
}
14342
Py_DECREF(__pyx_m); __pyx_m = 0;
14343
} else if (!PyErr_Occurred()) {
14344
PyErr_SetString(PyExc_ImportError, "init code.alex.psage.psage.ellcurve.lseries.sqrt5");
14345
}
14346
__pyx_L0:;
14347
__Pyx_RefNannyFinishContext();
14348
#if PY_MAJOR_VERSION < 3
14349
return;
14350
#else
14351
return __pyx_m;
14352
#endif
14353
}
14354
14355
/* --- Runtime support code --- */
14356
/* Refnanny */
14357
#if CYTHON_REFNANNY
14358
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
14359
PyObject *m = NULL, *p = NULL;
14360
void *r = NULL;
14361
m = PyImport_ImportModule((char *)modname);
14362
if (!m) goto end;
14363
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
14364
if (!p) goto end;
14365
r = PyLong_AsVoidPtr(p);
14366
end:
14367
Py_XDECREF(p);
14368
Py_XDECREF(m);
14369
return (__Pyx_RefNannyAPIStruct *)r;
14370
}
14371
#endif
14372
14373
/* GetBuiltinName */
14374
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
14375
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
14376
if (unlikely(!result)) {
14377
PyErr_Format(PyExc_NameError,
14378
#if PY_MAJOR_VERSION >= 3
14379
"name '%U' is not defined", name);
14380
#else
14381
"name '%.200s' is not defined", PyString_AS_STRING(name));
14382
#endif
14383
}
14384
return result;
14385
}
14386
14387
/* ExtTypeTest */
14388
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
14389
if (unlikely(!type)) {
14390
PyErr_SetString(PyExc_SystemError, "Missing type object");
14391
return 0;
14392
}
14393
if (likely(PyObject_TypeCheck(obj, type)))
14394
return 1;
14395
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
14396
Py_TYPE(obj)->tp_name, type->tp_name);
14397
return 0;
14398
}
14399
14400
/* PyErrFetchRestore */
14401
#if CYTHON_FAST_THREAD_STATE
14402
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14403
PyObject *tmp_type, *tmp_value, *tmp_tb;
14404
tmp_type = tstate->curexc_type;
14405
tmp_value = tstate->curexc_value;
14406
tmp_tb = tstate->curexc_traceback;
14407
tstate->curexc_type = type;
14408
tstate->curexc_value = value;
14409
tstate->curexc_traceback = tb;
14410
Py_XDECREF(tmp_type);
14411
Py_XDECREF(tmp_value);
14412
Py_XDECREF(tmp_tb);
14413
}
14414
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14415
*type = tstate->curexc_type;
14416
*value = tstate->curexc_value;
14417
*tb = tstate->curexc_traceback;
14418
tstate->curexc_type = 0;
14419
tstate->curexc_value = 0;
14420
tstate->curexc_traceback = 0;
14421
}
14422
#endif
14423
14424
/* RaiseException */
14425
#if PY_MAJOR_VERSION < 3
14426
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
14427
CYTHON_UNUSED PyObject *cause) {
14428
__Pyx_PyThreadState_declare
14429
Py_XINCREF(type);
14430
if (!value || value == Py_None)
14431
value = NULL;
14432
else
14433
Py_INCREF(value);
14434
if (!tb || tb == Py_None)
14435
tb = NULL;
14436
else {
14437
Py_INCREF(tb);
14438
if (!PyTraceBack_Check(tb)) {
14439
PyErr_SetString(PyExc_TypeError,
14440
"raise: arg 3 must be a traceback or None");
14441
goto raise_error;
14442
}
14443
}
14444
if (PyType_Check(type)) {
14445
#if CYTHON_COMPILING_IN_PYPY
14446
if (!value) {
14447
Py_INCREF(Py_None);
14448
value = Py_None;
14449
}
14450
#endif
14451
PyErr_NormalizeException(&type, &value, &tb);
14452
} else {
14453
if (value) {
14454
PyErr_SetString(PyExc_TypeError,
14455
"instance exception may not have a separate value");
14456
goto raise_error;
14457
}
14458
value = type;
14459
type = (PyObject*) Py_TYPE(type);
14460
Py_INCREF(type);
14461
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
14462
PyErr_SetString(PyExc_TypeError,
14463
"raise: exception class must be a subclass of BaseException");
14464
goto raise_error;
14465
}
14466
}
14467
__Pyx_PyThreadState_assign
14468
__Pyx_ErrRestore(type, value, tb);
14469
return;
14470
raise_error:
14471
Py_XDECREF(value);
14472
Py_XDECREF(type);
14473
Py_XDECREF(tb);
14474
return;
14475
}
14476
#else
14477
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
14478
PyObject* owned_instance = NULL;
14479
if (tb == Py_None) {
14480
tb = 0;
14481
} else if (tb && !PyTraceBack_Check(tb)) {
14482
PyErr_SetString(PyExc_TypeError,
14483
"raise: arg 3 must be a traceback or None");
14484
goto bad;
14485
}
14486
if (value == Py_None)
14487
value = 0;
14488
if (PyExceptionInstance_Check(type)) {
14489
if (value) {
14490
PyErr_SetString(PyExc_TypeError,
14491
"instance exception may not have a separate value");
14492
goto bad;
14493
}
14494
value = type;
14495
type = (PyObject*) Py_TYPE(value);
14496
} else if (PyExceptionClass_Check(type)) {
14497
PyObject *instance_class = NULL;
14498
if (value && PyExceptionInstance_Check(value)) {
14499
instance_class = (PyObject*) Py_TYPE(value);
14500
if (instance_class != type) {
14501
int is_subclass = PyObject_IsSubclass(instance_class, type);
14502
if (!is_subclass) {
14503
instance_class = NULL;
14504
} else if (unlikely(is_subclass == -1)) {
14505
goto bad;
14506
} else {
14507
type = instance_class;
14508
}
14509
}
14510
}
14511
if (!instance_class) {
14512
PyObject *args;
14513
if (!value)
14514
args = PyTuple_New(0);
14515
else if (PyTuple_Check(value)) {
14516
Py_INCREF(value);
14517
args = value;
14518
} else
14519
args = PyTuple_Pack(1, value);
14520
if (!args)
14521
goto bad;
14522
owned_instance = PyObject_Call(type, args, NULL);
14523
Py_DECREF(args);
14524
if (!owned_instance)
14525
goto bad;
14526
value = owned_instance;
14527
if (!PyExceptionInstance_Check(value)) {
14528
PyErr_Format(PyExc_TypeError,
14529
"calling %R should have returned an instance of "
14530
"BaseException, not %R",
14531
type, Py_TYPE(value));
14532
goto bad;
14533
}
14534
}
14535
} else {
14536
PyErr_SetString(PyExc_TypeError,
14537
"raise: exception class must be a subclass of BaseException");
14538
goto bad;
14539
}
14540
#if PY_VERSION_HEX >= 0x03030000
14541
if (cause) {
14542
#else
14543
if (cause && cause != Py_None) {
14544
#endif
14545
PyObject *fixed_cause;
14546
if (cause == Py_None) {
14547
fixed_cause = NULL;
14548
} else if (PyExceptionClass_Check(cause)) {
14549
fixed_cause = PyObject_CallObject(cause, NULL);
14550
if (fixed_cause == NULL)
14551
goto bad;
14552
} else if (PyExceptionInstance_Check(cause)) {
14553
fixed_cause = cause;
14554
Py_INCREF(fixed_cause);
14555
} else {
14556
PyErr_SetString(PyExc_TypeError,
14557
"exception causes must derive from "
14558
"BaseException");
14559
goto bad;
14560
}
14561
PyException_SetCause(value, fixed_cause);
14562
}
14563
PyErr_SetObject(type, value);
14564
if (tb) {
14565
#if CYTHON_COMPILING_IN_PYPY
14566
PyObject *tmp_type, *tmp_value, *tmp_tb;
14567
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
14568
Py_INCREF(tb);
14569
PyErr_Restore(tmp_type, tmp_value, tb);
14570
Py_XDECREF(tmp_tb);
14571
#else
14572
PyThreadState *tstate = PyThreadState_GET();
14573
PyObject* tmp_tb = tstate->curexc_traceback;
14574
if (tb != tmp_tb) {
14575
Py_INCREF(tb);
14576
tstate->curexc_traceback = tb;
14577
Py_XDECREF(tmp_tb);
14578
}
14579
#endif
14580
}
14581
bad:
14582
Py_XDECREF(owned_instance);
14583
return;
14584
}
14585
#endif
14586
14587
/* None */
14588
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
14589
long q = a / b;
14590
long r = a - q*b;
14591
q -= ((r != 0) & ((r ^ b) < 0));
14592
return q;
14593
}
14594
14595
/* RaiseArgTupleInvalid */
14596
static void __Pyx_RaiseArgtupleInvalid(
14597
const char* func_name,
14598
int exact,
14599
Py_ssize_t num_min,
14600
Py_ssize_t num_max,
14601
Py_ssize_t num_found)
14602
{
14603
Py_ssize_t num_expected;
14604
const char *more_or_less;
14605
if (num_found < num_min) {
14606
num_expected = num_min;
14607
more_or_less = "at least";
14608
} else {
14609
num_expected = num_max;
14610
more_or_less = "at most";
14611
}
14612
if (exact) {
14613
more_or_less = "exactly";
14614
}
14615
PyErr_Format(PyExc_TypeError,
14616
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
14617
func_name, more_or_less, num_expected,
14618
(num_expected == 1) ? "" : "s", num_found);
14619
}
14620
14621
/* RaiseDoubleKeywords */
14622
static void __Pyx_RaiseDoubleKeywordsError(
14623
const char* func_name,
14624
PyObject* kw_name)
14625
{
14626
PyErr_Format(PyExc_TypeError,
14627
#if PY_MAJOR_VERSION >= 3
14628
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
14629
#else
14630
"%s() got multiple values for keyword argument '%s'", func_name,
14631
PyString_AsString(kw_name));
14632
#endif
14633
}
14634
14635
/* ParseKeywords */
14636
static int __Pyx_ParseOptionalKeywords(
14637
PyObject *kwds,
14638
PyObject **argnames[],
14639
PyObject *kwds2,
14640
PyObject *values[],
14641
Py_ssize_t num_pos_args,
14642
const char* function_name)
14643
{
14644
PyObject *key = 0, *value = 0;
14645
Py_ssize_t pos = 0;
14646
PyObject*** name;
14647
PyObject*** first_kw_arg = argnames + num_pos_args;
14648
while (PyDict_Next(kwds, &pos, &key, &value)) {
14649
name = first_kw_arg;
14650
while (*name && (**name != key)) name++;
14651
if (*name) {
14652
values[name-argnames] = value;
14653
continue;
14654
}
14655
name = first_kw_arg;
14656
#if PY_MAJOR_VERSION < 3
14657
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
14658
while (*name) {
14659
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
14660
&& _PyString_Eq(**name, key)) {
14661
values[name-argnames] = value;
14662
break;
14663
}
14664
name++;
14665
}
14666
if (*name) continue;
14667
else {
14668
PyObject*** argname = argnames;
14669
while (argname != first_kw_arg) {
14670
if ((**argname == key) || (
14671
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
14672
&& _PyString_Eq(**argname, key))) {
14673
goto arg_passed_twice;
14674
}
14675
argname++;
14676
}
14677
}
14678
} else
14679
#endif
14680
if (likely(PyUnicode_Check(key))) {
14681
while (*name) {
14682
int cmp = (**name == key) ? 0 :
14683
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
14684
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
14685
#endif
14686
PyUnicode_Compare(**name, key);
14687
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
14688
if (cmp == 0) {
14689
values[name-argnames] = value;
14690
break;
14691
}
14692
name++;
14693
}
14694
if (*name) continue;
14695
else {
14696
PyObject*** argname = argnames;
14697
while (argname != first_kw_arg) {
14698
int cmp = (**argname == key) ? 0 :
14699
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
14700
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
14701
#endif
14702
PyUnicode_Compare(**argname, key);
14703
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
14704
if (cmp == 0) goto arg_passed_twice;
14705
argname++;
14706
}
14707
}
14708
} else
14709
goto invalid_keyword_type;
14710
if (kwds2) {
14711
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
14712
} else {
14713
goto invalid_keyword;
14714
}
14715
}
14716
return 0;
14717
arg_passed_twice:
14718
__Pyx_RaiseDoubleKeywordsError(function_name, key);
14719
goto bad;
14720
invalid_keyword_type:
14721
PyErr_Format(PyExc_TypeError,
14722
"%.200s() keywords must be strings", function_name);
14723
goto bad;
14724
invalid_keyword:
14725
PyErr_Format(PyExc_TypeError,
14726
#if PY_MAJOR_VERSION < 3
14727
"%.200s() got an unexpected keyword argument '%.200s'",
14728
function_name, PyString_AsString(key));
14729
#else
14730
"%s() got an unexpected keyword argument '%U'",
14731
function_name, key);
14732
#endif
14733
bad:
14734
return -1;
14735
}
14736
14737
/* ArgTypeTest */
14738
static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
14739
PyErr_Format(PyExc_TypeError,
14740
"Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
14741
name, type->tp_name, Py_TYPE(obj)->tp_name);
14742
}
14743
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
14744
const char *name, int exact)
14745
{
14746
if (unlikely(!type)) {
14747
PyErr_SetString(PyExc_SystemError, "Missing type object");
14748
return 0;
14749
}
14750
if (none_allowed && obj == Py_None) return 1;
14751
else if (exact) {
14752
if (likely(Py_TYPE(obj) == type)) return 1;
14753
#if PY_MAJOR_VERSION == 2
14754
else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
14755
#endif
14756
}
14757
else {
14758
if (likely(PyObject_TypeCheck(obj, type))) return 1;
14759
}
14760
__Pyx_RaiseArgumentTypeInvalid(name, obj, type);
14761
return 0;
14762
}
14763
14764
/* KeywordStringCheck */
14765
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
14766
PyObject *kwdict,
14767
const char* function_name,
14768
int kw_allowed)
14769
{
14770
PyObject* key = 0;
14771
Py_ssize_t pos = 0;
14772
#if CYTHON_COMPILING_IN_PYPY
14773
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
14774
goto invalid_keyword;
14775
return 1;
14776
#else
14777
while (PyDict_Next(kwdict, &pos, &key, 0)) {
14778
#if PY_MAJOR_VERSION < 3
14779
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
14780
#endif
14781
if (unlikely(!PyUnicode_Check(key)))
14782
goto invalid_keyword_type;
14783
}
14784
if ((!kw_allowed) && unlikely(key))
14785
goto invalid_keyword;
14786
return 1;
14787
invalid_keyword_type:
14788
PyErr_Format(PyExc_TypeError,
14789
"%.200s() keywords must be strings", function_name);
14790
return 0;
14791
#endif
14792
invalid_keyword:
14793
PyErr_Format(PyExc_TypeError,
14794
#if PY_MAJOR_VERSION < 3
14795
"%.200s() got an unexpected keyword argument '%.200s'",
14796
function_name, PyString_AsString(key));
14797
#else
14798
"%s() got an unexpected keyword argument '%U'",
14799
function_name, key);
14800
#endif
14801
return 0;
14802
}
14803
14804
/* PyCFunctionFastCall */
14805
#if CYTHON_FAST_PYCCALL
14806
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
14807
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
14808
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
14809
PyObject *self = PyCFunction_GET_SELF(func);
14810
assert(PyCFunction_Check(func));
14811
assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
14812
assert(nargs >= 0);
14813
assert(nargs == 0 || args != NULL);
14814
/* _PyCFunction_FastCallDict() must not be called with an exception set,
14815
because it may clear it (directly or indirectly) and so the
14816
caller loses its exception */
14817
assert(!PyErr_Occurred());
14818
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
14819
}
14820
#endif // CYTHON_FAST_PYCCALL
14821
14822
/* PyFunctionFastCall */
14823
#if CYTHON_FAST_PYCALL
14824
#include "frameobject.h"
14825
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
14826
PyObject *globals) {
14827
PyFrameObject *f;
14828
PyThreadState *tstate = PyThreadState_GET();
14829
PyObject **fastlocals;
14830
Py_ssize_t i;
14831
PyObject *result;
14832
assert(globals != NULL);
14833
/* XXX Perhaps we should create a specialized
14834
PyFrame_New() that doesn't take locals, but does
14835
take builtins without sanity checking them.
14836
*/
14837
assert(tstate != NULL);
14838
f = PyFrame_New(tstate, co, globals, NULL);
14839
if (f == NULL) {
14840
return NULL;
14841
}
14842
fastlocals = f->f_localsplus;
14843
for (i = 0; i < na; i++) {
14844
Py_INCREF(*args);
14845
fastlocals[i] = *args++;
14846
}
14847
result = PyEval_EvalFrameEx(f,0);
14848
++tstate->recursion_depth;
14849
Py_DECREF(f);
14850
--tstate->recursion_depth;
14851
return result;
14852
}
14853
#if 1 || PY_VERSION_HEX < 0x030600B1
14854
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
14855
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
14856
PyObject *globals = PyFunction_GET_GLOBALS(func);
14857
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
14858
PyObject *closure;
14859
#if PY_MAJOR_VERSION >= 3
14860
PyObject *kwdefs;
14861
#endif
14862
PyObject *kwtuple, **k;
14863
PyObject **d;
14864
Py_ssize_t nd;
14865
Py_ssize_t nk;
14866
PyObject *result;
14867
assert(kwargs == NULL || PyDict_Check(kwargs));
14868
nk = kwargs ? PyDict_Size(kwargs) : 0;
14869
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
14870
return NULL;
14871
}
14872
if (
14873
#if PY_MAJOR_VERSION >= 3
14874
co->co_kwonlyargcount == 0 &&
14875
#endif
14876
likely(kwargs == NULL || nk == 0) &&
14877
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
14878
if (argdefs == NULL && co->co_argcount == nargs) {
14879
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
14880
goto done;
14881
}
14882
else if (nargs == 0 && argdefs != NULL
14883
&& co->co_argcount == Py_SIZE(argdefs)) {
14884
/* function called with no arguments, but all parameters have
14885
a default value: use default values as arguments .*/
14886
args = &PyTuple_GET_ITEM(argdefs, 0);
14887
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
14888
goto done;
14889
}
14890
}
14891
if (kwargs != NULL) {
14892
Py_ssize_t pos, i;
14893
kwtuple = PyTuple_New(2 * nk);
14894
if (kwtuple == NULL) {
14895
result = NULL;
14896
goto done;
14897
}
14898
k = &PyTuple_GET_ITEM(kwtuple, 0);
14899
pos = i = 0;
14900
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
14901
Py_INCREF(k[i]);
14902
Py_INCREF(k[i+1]);
14903
i += 2;
14904
}
14905
nk = i / 2;
14906
}
14907
else {
14908
kwtuple = NULL;
14909
k = NULL;
14910
}
14911
closure = PyFunction_GET_CLOSURE(func);
14912
#if PY_MAJOR_VERSION >= 3
14913
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
14914
#endif
14915
if (argdefs != NULL) {
14916
d = &PyTuple_GET_ITEM(argdefs, 0);
14917
nd = Py_SIZE(argdefs);
14918
}
14919
else {
14920
d = NULL;
14921
nd = 0;
14922
}
14923
#if PY_MAJOR_VERSION >= 3
14924
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
14925
args, nargs,
14926
k, (int)nk,
14927
d, (int)nd, kwdefs, closure);
14928
#else
14929
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
14930
args, nargs,
14931
k, (int)nk,
14932
d, (int)nd, closure);
14933
#endif
14934
Py_XDECREF(kwtuple);
14935
done:
14936
Py_LeaveRecursiveCall();
14937
return result;
14938
}
14939
#endif // CPython < 3.6
14940
#endif // CYTHON_FAST_PYCALL
14941
14942
/* PyObjectCall */
14943
#if CYTHON_COMPILING_IN_CPYTHON
14944
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
14945
PyObject *result;
14946
ternaryfunc call = func->ob_type->tp_call;
14947
if (unlikely(!call))
14948
return PyObject_Call(func, arg, kw);
14949
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
14950
return NULL;
14951
result = (*call)(func, arg, kw);
14952
Py_LeaveRecursiveCall();
14953
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14954
PyErr_SetString(
14955
PyExc_SystemError,
14956
"NULL result without error in PyObject_Call");
14957
}
14958
return result;
14959
}
14960
#endif
14961
14962
/* PyObjectCallMethO */
14963
#if CYTHON_COMPILING_IN_CPYTHON
14964
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
14965
PyObject *self, *result;
14966
PyCFunction cfunc;
14967
cfunc = PyCFunction_GET_FUNCTION(func);
14968
self = PyCFunction_GET_SELF(func);
14969
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
14970
return NULL;
14971
result = cfunc(self, arg);
14972
Py_LeaveRecursiveCall();
14973
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
14974
PyErr_SetString(
14975
PyExc_SystemError,
14976
"NULL result without error in PyObject_Call");
14977
}
14978
return result;
14979
}
14980
#endif
14981
14982
/* PyObjectCallOneArg */
14983
#if CYTHON_COMPILING_IN_CPYTHON
14984
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14985
PyObject *result;
14986
PyObject *args = PyTuple_New(1);
14987
if (unlikely(!args)) return NULL;
14988
Py_INCREF(arg);
14989
PyTuple_SET_ITEM(args, 0, arg);
14990
result = __Pyx_PyObject_Call(func, args, NULL);
14991
Py_DECREF(args);
14992
return result;
14993
}
14994
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
14995
#if CYTHON_FAST_PYCALL
14996
if (PyFunction_Check(func)) {
14997
return __Pyx_PyFunction_FastCall(func, &arg, 1);
14998
}
14999
#endif
15000
#ifdef __Pyx_CyFunction_USED
15001
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
15002
#else
15003
if (likely(PyCFunction_Check(func))) {
15004
#endif
15005
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
15006
return __Pyx_PyObject_CallMethO(func, arg);
15007
#if CYTHON_FAST_PYCCALL
15008
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
15009
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
15010
#endif
15011
}
15012
}
15013
return __Pyx__PyObject_CallOneArg(func, arg);
15014
}
15015
#else
15016
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
15017
PyObject *result;
15018
PyObject *args = PyTuple_Pack(1, arg);
15019
if (unlikely(!args)) return NULL;
15020
result = __Pyx_PyObject_Call(func, args, NULL);
15021
Py_DECREF(args);
15022
return result;
15023
}
15024
#endif
15025
15026
/* GetModuleGlobalName */
15027
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
15028
PyObject *result;
15029
#if !CYTHON_AVOID_BORROWED_REFS
15030
result = PyDict_GetItem(__pyx_d, name);
15031
if (likely(result)) {
15032
Py_INCREF(result);
15033
} else {
15034
#else
15035
result = PyObject_GetItem(__pyx_d, name);
15036
if (!result) {
15037
PyErr_Clear();
15038
#endif
15039
result = __Pyx_GetBuiltinName(name);
15040
}
15041
return result;
15042
}
15043
15044
/* None */
15045
static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
15046
long r = a % b;
15047
r += ((r != 0) & ((r ^ b) < 0)) * b;
15048
return r;
15049
}
15050
15051
/* PyObjectCallNoArg */
15052
#if CYTHON_COMPILING_IN_CPYTHON
15053
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
15054
#if CYTHON_FAST_PYCALL
15055
if (PyFunction_Check(func)) {
15056
return __Pyx_PyFunction_FastCall(func, NULL, 0);
15057
}
15058
#endif
15059
#ifdef __Pyx_CyFunction_USED
15060
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
15061
#else
15062
if (likely(PyCFunction_Check(func))) {
15063
#endif
15064
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
15065
return __Pyx_PyObject_CallMethO(func, NULL);
15066
}
15067
}
15068
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
15069
}
15070
#endif
15071
15072
/* RaiseTooManyValuesToUnpack */
15073
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
15074
PyErr_Format(PyExc_ValueError,
15075
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
15076
}
15077
15078
/* RaiseNeedMoreValuesToUnpack */
15079
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
15080
PyErr_Format(PyExc_ValueError,
15081
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
15082
index, (index == 1) ? "" : "s");
15083
}
15084
15085
/* IterFinish */
15086
static CYTHON_INLINE int __Pyx_IterFinish(void) {
15087
#if CYTHON_FAST_THREAD_STATE
15088
PyThreadState *tstate = PyThreadState_GET();
15089
PyObject* exc_type = tstate->curexc_type;
15090
if (unlikely(exc_type)) {
15091
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
15092
PyObject *exc_value, *exc_tb;
15093
exc_value = tstate->curexc_value;
15094
exc_tb = tstate->curexc_traceback;
15095
tstate->curexc_type = 0;
15096
tstate->curexc_value = 0;
15097
tstate->curexc_traceback = 0;
15098
Py_DECREF(exc_type);
15099
Py_XDECREF(exc_value);
15100
Py_XDECREF(exc_tb);
15101
return 0;
15102
} else {
15103
return -1;
15104
}
15105
}
15106
return 0;
15107
#else
15108
if (unlikely(PyErr_Occurred())) {
15109
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
15110
PyErr_Clear();
15111
return 0;
15112
} else {
15113
return -1;
15114
}
15115
}
15116
return 0;
15117
#endif
15118
}
15119
15120
/* UnpackItemEndCheck */
15121
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
15122
if (unlikely(retval)) {
15123
Py_DECREF(retval);
15124
__Pyx_RaiseTooManyValuesError(expected);
15125
return -1;
15126
} else {
15127
return __Pyx_IterFinish();
15128
}
15129
return 0;
15130
}
15131
15132
/* GetItemInt */
15133
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
15134
PyObject *r;
15135
if (!j) return NULL;
15136
r = PyObject_GetItem(o, j);
15137
Py_DECREF(j);
15138
return r;
15139
}
15140
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
15141
CYTHON_NCP_UNUSED int wraparound,
15142
CYTHON_NCP_UNUSED int boundscheck) {
15143
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15144
if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
15145
if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
15146
PyObject *r = PyList_GET_ITEM(o, i);
15147
Py_INCREF(r);
15148
return r;
15149
}
15150
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
15151
#else
15152
return PySequence_GetItem(o, i);
15153
#endif
15154
}
15155
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
15156
CYTHON_NCP_UNUSED int wraparound,
15157
CYTHON_NCP_UNUSED int boundscheck) {
15158
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15159
if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
15160
if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
15161
PyObject *r = PyTuple_GET_ITEM(o, i);
15162
Py_INCREF(r);
15163
return r;
15164
}
15165
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
15166
#else
15167
return PySequence_GetItem(o, i);
15168
#endif
15169
}
15170
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
15171
CYTHON_NCP_UNUSED int wraparound,
15172
CYTHON_NCP_UNUSED int boundscheck) {
15173
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
15174
if (is_list || PyList_CheckExact(o)) {
15175
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
15176
if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
15177
PyObject *r = PyList_GET_ITEM(o, n);
15178
Py_INCREF(r);
15179
return r;
15180
}
15181
}
15182
else if (PyTuple_CheckExact(o)) {
15183
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
15184
if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
15185
PyObject *r = PyTuple_GET_ITEM(o, n);
15186
Py_INCREF(r);
15187
return r;
15188
}
15189
} else {
15190
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
15191
if (likely(m && m->sq_item)) {
15192
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
15193
Py_ssize_t l = m->sq_length(o);
15194
if (likely(l >= 0)) {
15195
i += l;
15196
} else {
15197
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
15198
return NULL;
15199
PyErr_Clear();
15200
}
15201
}
15202
return m->sq_item(o, i);
15203
}
15204
}
15205
#else
15206
if (is_list || PySequence_Check(o)) {
15207
return PySequence_GetItem(o, i);
15208
}
15209
#endif
15210
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
15211
}
15212
15213
/* BytesEquals */
15214
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
15215
#if CYTHON_COMPILING_IN_PYPY
15216
return PyObject_RichCompareBool(s1, s2, equals);
15217
#else
15218
if (s1 == s2) {
15219
return (equals == Py_EQ);
15220
} else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
15221
const char *ps1, *ps2;
15222
Py_ssize_t length = PyBytes_GET_SIZE(s1);
15223
if (length != PyBytes_GET_SIZE(s2))
15224
return (equals == Py_NE);
15225
ps1 = PyBytes_AS_STRING(s1);
15226
ps2 = PyBytes_AS_STRING(s2);
15227
if (ps1[0] != ps2[0]) {
15228
return (equals == Py_NE);
15229
} else if (length == 1) {
15230
return (equals == Py_EQ);
15231
} else {
15232
int result = memcmp(ps1, ps2, (size_t)length);
15233
return (equals == Py_EQ) ? (result == 0) : (result != 0);
15234
}
15235
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
15236
return (equals == Py_NE);
15237
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
15238
return (equals == Py_NE);
15239
} else {
15240
int result;
15241
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
15242
if (!py_result)
15243
return -1;
15244
result = __Pyx_PyObject_IsTrue(py_result);
15245
Py_DECREF(py_result);
15246
return result;
15247
}
15248
#endif
15249
}
15250
15251
/* UnicodeEquals */
15252
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
15253
#if CYTHON_COMPILING_IN_PYPY
15254
return PyObject_RichCompareBool(s1, s2, equals);
15255
#else
15256
#if PY_MAJOR_VERSION < 3
15257
PyObject* owned_ref = NULL;
15258
#endif
15259
int s1_is_unicode, s2_is_unicode;
15260
if (s1 == s2) {
15261
goto return_eq;
15262
}
15263
s1_is_unicode = PyUnicode_CheckExact(s1);
15264
s2_is_unicode = PyUnicode_CheckExact(s2);
15265
#if PY_MAJOR_VERSION < 3
15266
if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
15267
owned_ref = PyUnicode_FromObject(s2);
15268
if (unlikely(!owned_ref))
15269
return -1;
15270
s2 = owned_ref;
15271
s2_is_unicode = 1;
15272
} else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
15273
owned_ref = PyUnicode_FromObject(s1);
15274
if (unlikely(!owned_ref))
15275
return -1;
15276
s1 = owned_ref;
15277
s1_is_unicode = 1;
15278
} else if (((!s2_is_unicode) & (!s1_is_unicode))) {
15279
return __Pyx_PyBytes_Equals(s1, s2, equals);
15280
}
15281
#endif
15282
if (s1_is_unicode & s2_is_unicode) {
15283
Py_ssize_t length;
15284
int kind;
15285
void *data1, *data2;
15286
if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
15287
return -1;
15288
length = __Pyx_PyUnicode_GET_LENGTH(s1);
15289
if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
15290
goto return_ne;
15291
}
15292
kind = __Pyx_PyUnicode_KIND(s1);
15293
if (kind != __Pyx_PyUnicode_KIND(s2)) {
15294
goto return_ne;
15295
}
15296
data1 = __Pyx_PyUnicode_DATA(s1);
15297
data2 = __Pyx_PyUnicode_DATA(s2);
15298
if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
15299
goto return_ne;
15300
} else if (length == 1) {
15301
goto return_eq;
15302
} else {
15303
int result = memcmp(data1, data2, (size_t)(length * kind));
15304
#if PY_MAJOR_VERSION < 3
15305
Py_XDECREF(owned_ref);
15306
#endif
15307
return (equals == Py_EQ) ? (result == 0) : (result != 0);
15308
}
15309
} else if ((s1 == Py_None) & s2_is_unicode) {
15310
goto return_ne;
15311
} else if ((s2 == Py_None) & s1_is_unicode) {
15312
goto return_ne;
15313
} else {
15314
int result;
15315
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
15316
if (!py_result)
15317
return -1;
15318
result = __Pyx_PyObject_IsTrue(py_result);
15319
Py_DECREF(py_result);
15320
return result;
15321
}
15322
return_eq:
15323
#if PY_MAJOR_VERSION < 3
15324
Py_XDECREF(owned_ref);
15325
#endif
15326
return (equals == Py_EQ);
15327
return_ne:
15328
#if PY_MAJOR_VERSION < 3
15329
Py_XDECREF(owned_ref);
15330
#endif
15331
return (equals == Py_NE);
15332
#endif
15333
}
15334
15335
/* SaveResetException */
15336
#if CYTHON_FAST_THREAD_STATE
15337
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
15338
*type = tstate->exc_type;
15339
*value = tstate->exc_value;
15340
*tb = tstate->exc_traceback;
15341
Py_XINCREF(*type);
15342
Py_XINCREF(*value);
15343
Py_XINCREF(*tb);
15344
}
15345
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
15346
PyObject *tmp_type, *tmp_value, *tmp_tb;
15347
tmp_type = tstate->exc_type;
15348
tmp_value = tstate->exc_value;
15349
tmp_tb = tstate->exc_traceback;
15350
tstate->exc_type = type;
15351
tstate->exc_value = value;
15352
tstate->exc_traceback = tb;
15353
Py_XDECREF(tmp_type);
15354
Py_XDECREF(tmp_value);
15355
Py_XDECREF(tmp_tb);
15356
}
15357
#endif
15358
15359
/* PyErrExceptionMatches */
15360
#if CYTHON_FAST_THREAD_STATE
15361
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
15362
PyObject *exc_type = tstate->curexc_type;
15363
if (exc_type == err) return 1;
15364
if (unlikely(!exc_type)) return 0;
15365
return PyErr_GivenExceptionMatches(exc_type, err);
15366
}
15367
#endif
15368
15369
/* GetException */
15370
#if CYTHON_FAST_THREAD_STATE
15371
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
15372
#else
15373
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
15374
#endif
15375
PyObject *local_type, *local_value, *local_tb;
15376
#if CYTHON_FAST_THREAD_STATE
15377
PyObject *tmp_type, *tmp_value, *tmp_tb;
15378
local_type = tstate->curexc_type;
15379
local_value = tstate->curexc_value;
15380
local_tb = tstate->curexc_traceback;
15381
tstate->curexc_type = 0;
15382
tstate->curexc_value = 0;
15383
tstate->curexc_traceback = 0;
15384
#else
15385
PyErr_Fetch(&local_type, &local_value, &local_tb);
15386
#endif
15387
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
15388
#if CYTHON_FAST_THREAD_STATE
15389
if (unlikely(tstate->curexc_type))
15390
#else
15391
if (unlikely(PyErr_Occurred()))
15392
#endif
15393
goto bad;
15394
#if PY_MAJOR_VERSION >= 3
15395
if (local_tb) {
15396
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
15397
goto bad;
15398
}
15399
#endif
15400
Py_XINCREF(local_tb);
15401
Py_XINCREF(local_type);
15402
Py_XINCREF(local_value);
15403
*type = local_type;
15404
*value = local_value;
15405
*tb = local_tb;
15406
#if CYTHON_FAST_THREAD_STATE
15407
tmp_type = tstate->exc_type;
15408
tmp_value = tstate->exc_value;
15409
tmp_tb = tstate->exc_traceback;
15410
tstate->exc_type = local_type;
15411
tstate->exc_value = local_value;
15412
tstate->exc_traceback = local_tb;
15413
Py_XDECREF(tmp_type);
15414
Py_XDECREF(tmp_value);
15415
Py_XDECREF(tmp_tb);
15416
#else
15417
PyErr_SetExcInfo(local_type, local_value, local_tb);
15418
#endif
15419
return 0;
15420
bad:
15421
*type = 0;
15422
*value = 0;
15423
*tb = 0;
15424
Py_XDECREF(local_type);
15425
Py_XDECREF(local_value);
15426
Py_XDECREF(local_tb);
15427
return -1;
15428
}
15429
15430
/* Import */
15431
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
15432
PyObject *empty_list = 0;
15433
PyObject *module = 0;
15434
PyObject *global_dict = 0;
15435
PyObject *empty_dict = 0;
15436
PyObject *list;
15437
#if PY_VERSION_HEX < 0x03030000
15438
PyObject *py_import;
15439
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
15440
if (!py_import)
15441
goto bad;
15442
#endif
15443
if (from_list)
15444
list = from_list;
15445
else {
15446
empty_list = PyList_New(0);
15447
if (!empty_list)
15448
goto bad;
15449
list = empty_list;
15450
}
15451
global_dict = PyModule_GetDict(__pyx_m);
15452
if (!global_dict)
15453
goto bad;
15454
empty_dict = PyDict_New();
15455
if (!empty_dict)
15456
goto bad;
15457
{
15458
#if PY_MAJOR_VERSION >= 3
15459
if (level == -1) {
15460
if (strchr(__Pyx_MODULE_NAME, '.')) {
15461
#if PY_VERSION_HEX < 0x03030000
15462
PyObject *py_level = PyInt_FromLong(1);
15463
if (!py_level)
15464
goto bad;
15465
module = PyObject_CallFunctionObjArgs(py_import,
15466
name, global_dict, empty_dict, list, py_level, NULL);
15467
Py_DECREF(py_level);
15468
#else
15469
module = PyImport_ImportModuleLevelObject(
15470
name, global_dict, empty_dict, list, 1);
15471
#endif
15472
if (!module) {
15473
if (!PyErr_ExceptionMatches(PyExc_ImportError))
15474
goto bad;
15475
PyErr_Clear();
15476
}
15477
}
15478
level = 0;
15479
}
15480
#endif
15481
if (!module) {
15482
#if PY_VERSION_HEX < 0x03030000
15483
PyObject *py_level = PyInt_FromLong(level);
15484
if (!py_level)
15485
goto bad;
15486
module = PyObject_CallFunctionObjArgs(py_import,
15487
name, global_dict, empty_dict, list, py_level, NULL);
15488
Py_DECREF(py_level);
15489
#else
15490
module = PyImport_ImportModuleLevelObject(
15491
name, global_dict, empty_dict, list, level);
15492
#endif
15493
}
15494
}
15495
bad:
15496
#if PY_VERSION_HEX < 0x03030000
15497
Py_XDECREF(py_import);
15498
#endif
15499
Py_XDECREF(empty_list);
15500
Py_XDECREF(empty_dict);
15501
return module;
15502
}
15503
15504
/* ImportFrom */
15505
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
15506
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
15507
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
15508
PyErr_Format(PyExc_ImportError,
15509
#if PY_MAJOR_VERSION < 3
15510
"cannot import name %.230s", PyString_AS_STRING(name));
15511
#else
15512
"cannot import name %S", name);
15513
#endif
15514
}
15515
return value;
15516
}
15517
15518
/* PyIntBinop */
15519
#if !CYTHON_COMPILING_IN_PYPY
15520
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
15521
#if PY_MAJOR_VERSION < 3
15522
if (likely(PyInt_CheckExact(op1))) {
15523
const long b = intval;
15524
long x;
15525
long a = PyInt_AS_LONG(op1);
15526
x = (long)((unsigned long)a - b);
15527
if (likely((x^a) >= 0 || (x^~b) >= 0))
15528
return PyInt_FromLong(x);
15529
return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
15530
}
15531
#endif
15532
#if CYTHON_USE_PYLONG_INTERNALS
15533
if (likely(PyLong_CheckExact(op1))) {
15534
const long b = intval;
15535
long a, x;
15536
#ifdef HAVE_LONG_LONG
15537
const PY_LONG_LONG llb = intval;
15538
PY_LONG_LONG lla, llx;
15539
#endif
15540
const digit* digits = ((PyLongObject*)op1)->ob_digit;
15541
const Py_ssize_t size = Py_SIZE(op1);
15542
if (likely(__Pyx_sst_abs(size) <= 1)) {
15543
a = likely(size) ? digits[0] : 0;
15544
if (size == -1) a = -a;
15545
} else {
15546
switch (size) {
15547
case -2:
15548
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15549
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15550
break;
15551
#ifdef HAVE_LONG_LONG
15552
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15553
lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15554
goto long_long;
15555
#endif
15556
}
15557
case 2:
15558
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15559
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15560
break;
15561
#ifdef HAVE_LONG_LONG
15562
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15563
lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15564
goto long_long;
15565
#endif
15566
}
15567
case -3:
15568
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15569
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15570
break;
15571
#ifdef HAVE_LONG_LONG
15572
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15573
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]));
15574
goto long_long;
15575
#endif
15576
}
15577
case 3:
15578
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15579
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15580
break;
15581
#ifdef HAVE_LONG_LONG
15582
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15583
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]));
15584
goto long_long;
15585
#endif
15586
}
15587
case -4:
15588
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15589
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15590
break;
15591
#ifdef HAVE_LONG_LONG
15592
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15593
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]));
15594
goto long_long;
15595
#endif
15596
}
15597
case 4:
15598
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15599
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15600
break;
15601
#ifdef HAVE_LONG_LONG
15602
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15603
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]));
15604
goto long_long;
15605
#endif
15606
}
15607
default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
15608
}
15609
}
15610
x = a - b;
15611
return PyLong_FromLong(x);
15612
#ifdef HAVE_LONG_LONG
15613
long_long:
15614
llx = lla - llb;
15615
return PyLong_FromLongLong(llx);
15616
#endif
15617
15618
15619
}
15620
#endif
15621
if (PyFloat_CheckExact(op1)) {
15622
const long b = intval;
15623
double a = PyFloat_AS_DOUBLE(op1);
15624
double result;
15625
PyFPE_START_PROTECT("subtract", return NULL)
15626
result = ((double)a) - (double)b;
15627
PyFPE_END_PROTECT(result)
15628
return PyFloat_FromDouble(result);
15629
}
15630
return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
15631
}
15632
#endif
15633
15634
/* PyIntBinop */
15635
#if !CYTHON_COMPILING_IN_PYPY
15636
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
15637
#if PY_MAJOR_VERSION < 3
15638
if (likely(PyInt_CheckExact(op1))) {
15639
const long b = intval;
15640
long x;
15641
long a = PyInt_AS_LONG(op1);
15642
x = a % b;
15643
x += ((x != 0) & ((x ^ b) < 0)) * b;
15644
return PyInt_FromLong(x);
15645
}
15646
#endif
15647
#if CYTHON_USE_PYLONG_INTERNALS
15648
if (likely(PyLong_CheckExact(op1))) {
15649
const long b = intval;
15650
long a, x;
15651
#ifdef HAVE_LONG_LONG
15652
const PY_LONG_LONG llb = intval;
15653
PY_LONG_LONG lla, llx;
15654
#endif
15655
const digit* digits = ((PyLongObject*)op1)->ob_digit;
15656
const Py_ssize_t size = Py_SIZE(op1);
15657
if (likely(__Pyx_sst_abs(size) <= 1)) {
15658
a = likely(size) ? digits[0] : 0;
15659
if (size == -1) a = -a;
15660
} else {
15661
switch (size) {
15662
case -2:
15663
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15664
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15665
break;
15666
#ifdef HAVE_LONG_LONG
15667
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15668
lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15669
goto long_long;
15670
#endif
15671
}
15672
case 2:
15673
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15674
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15675
break;
15676
#ifdef HAVE_LONG_LONG
15677
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
15678
lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
15679
goto long_long;
15680
#endif
15681
}
15682
case -3:
15683
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15684
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15685
break;
15686
#ifdef HAVE_LONG_LONG
15687
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15688
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]));
15689
goto long_long;
15690
#endif
15691
}
15692
case 3:
15693
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15694
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15695
break;
15696
#ifdef HAVE_LONG_LONG
15697
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
15698
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]));
15699
goto long_long;
15700
#endif
15701
}
15702
case -4:
15703
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15704
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15705
break;
15706
#ifdef HAVE_LONG_LONG
15707
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15708
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]));
15709
goto long_long;
15710
#endif
15711
}
15712
case 4:
15713
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15714
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
15715
break;
15716
#ifdef HAVE_LONG_LONG
15717
} else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
15718
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]));
15719
goto long_long;
15720
#endif
15721
}
15722
default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
15723
}
15724
}
15725
x = a % b;
15726
x += ((x != 0) & ((x ^ b) < 0)) * b;
15727
return PyLong_FromLong(x);
15728
#ifdef HAVE_LONG_LONG
15729
long_long:
15730
llx = lla % llb;
15731
llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
15732
return PyLong_FromLongLong(llx);
15733
#endif
15734
15735
15736
}
15737
#endif
15738
return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
15739
}
15740
#endif
15741
15742
/* UnpackUnboundCMethod */
15743
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
15744
PyObject *method;
15745
method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
15746
if (unlikely(!method))
15747
return -1;
15748
target->method = method;
15749
#if CYTHON_COMPILING_IN_CPYTHON
15750
#if PY_MAJOR_VERSION >= 3
15751
if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type)))
15752
#endif
15753
{
15754
PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
15755
target->func = descr->d_method->ml_meth;
15756
target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST);
15757
}
15758
#endif
15759
return 0;
15760
}
15761
15762
/* CallUnboundCMethod0 */
15763
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
15764
PyObject *args, *result = NULL;
15765
if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
15766
#if CYTHON_ASSUME_SAFE_MACROS
15767
args = PyTuple_New(1);
15768
if (unlikely(!args)) goto bad;
15769
Py_INCREF(self);
15770
PyTuple_SET_ITEM(args, 0, self);
15771
#else
15772
args = PyTuple_Pack(1, self);
15773
if (unlikely(!args)) goto bad;
15774
#endif
15775
result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
15776
Py_DECREF(args);
15777
bad:
15778
return result;
15779
}
15780
15781
/* py_dict_keys */
15782
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
15783
if (PY_MAJOR_VERSION >= 3)
15784
return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
15785
else
15786
return PyDict_Keys(d);
15787
}
15788
15789
/* FetchCommonType */
15790
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
15791
PyObject* fake_module;
15792
PyTypeObject* cached_type = NULL;
15793
fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
15794
if (!fake_module) return NULL;
15795
Py_INCREF(fake_module);
15796
cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
15797
if (cached_type) {
15798
if (!PyType_Check((PyObject*)cached_type)) {
15799
PyErr_Format(PyExc_TypeError,
15800
"Shared Cython type %.200s is not a type object",
15801
type->tp_name);
15802
goto bad;
15803
}
15804
if (cached_type->tp_basicsize != type->tp_basicsize) {
15805
PyErr_Format(PyExc_TypeError,
15806
"Shared Cython type %.200s has the wrong size, try recompiling",
15807
type->tp_name);
15808
goto bad;
15809
}
15810
} else {
15811
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
15812
PyErr_Clear();
15813
if (PyType_Ready(type) < 0) goto bad;
15814
if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
15815
goto bad;
15816
Py_INCREF(type);
15817
cached_type = type;
15818
}
15819
done:
15820
Py_DECREF(fake_module);
15821
return cached_type;
15822
bad:
15823
Py_XDECREF(cached_type);
15824
cached_type = NULL;
15825
goto done;
15826
}
15827
15828
/* CythonFunction */
15829
static PyObject *
15830
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
15831
{
15832
if (unlikely(op->func_doc == NULL)) {
15833
if (op->func.m_ml->ml_doc) {
15834
#if PY_MAJOR_VERSION >= 3
15835
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
15836
#else
15837
op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
15838
#endif
15839
if (unlikely(op->func_doc == NULL))
15840
return NULL;
15841
} else {
15842
Py_INCREF(Py_None);
15843
return Py_None;
15844
}
15845
}
15846
Py_INCREF(op->func_doc);
15847
return op->func_doc;
15848
}
15849
static int
15850
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
15851
{
15852
PyObject *tmp = op->func_doc;
15853
if (value == NULL) {
15854
value = Py_None;
15855
}
15856
Py_INCREF(value);
15857
op->func_doc = value;
15858
Py_XDECREF(tmp);
15859
return 0;
15860
}
15861
static PyObject *
15862
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
15863
{
15864
if (unlikely(op->func_name == NULL)) {
15865
#if PY_MAJOR_VERSION >= 3
15866
op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
15867
#else
15868
op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
15869
#endif
15870
if (unlikely(op->func_name == NULL))
15871
return NULL;
15872
}
15873
Py_INCREF(op->func_name);
15874
return op->func_name;
15875
}
15876
static int
15877
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
15878
{
15879
PyObject *tmp;
15880
#if PY_MAJOR_VERSION >= 3
15881
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
15882
#else
15883
if (unlikely(value == NULL || !PyString_Check(value))) {
15884
#endif
15885
PyErr_SetString(PyExc_TypeError,
15886
"__name__ must be set to a string object");
15887
return -1;
15888
}
15889
tmp = op->func_name;
15890
Py_INCREF(value);
15891
op->func_name = value;
15892
Py_XDECREF(tmp);
15893
return 0;
15894
}
15895
static PyObject *
15896
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
15897
{
15898
Py_INCREF(op->func_qualname);
15899
return op->func_qualname;
15900
}
15901
static int
15902
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
15903
{
15904
PyObject *tmp;
15905
#if PY_MAJOR_VERSION >= 3
15906
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
15907
#else
15908
if (unlikely(value == NULL || !PyString_Check(value))) {
15909
#endif
15910
PyErr_SetString(PyExc_TypeError,
15911
"__qualname__ must be set to a string object");
15912
return -1;
15913
}
15914
tmp = op->func_qualname;
15915
Py_INCREF(value);
15916
op->func_qualname = value;
15917
Py_XDECREF(tmp);
15918
return 0;
15919
}
15920
static PyObject *
15921
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
15922
{
15923
PyObject *self;
15924
self = m->func_closure;
15925
if (self == NULL)
15926
self = Py_None;
15927
Py_INCREF(self);
15928
return self;
15929
}
15930
static PyObject *
15931
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
15932
{
15933
if (unlikely(op->func_dict == NULL)) {
15934
op->func_dict = PyDict_New();
15935
if (unlikely(op->func_dict == NULL))
15936
return NULL;
15937
}
15938
Py_INCREF(op->func_dict);
15939
return op->func_dict;
15940
}
15941
static int
15942
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
15943
{
15944
PyObject *tmp;
15945
if (unlikely(value == NULL)) {
15946
PyErr_SetString(PyExc_TypeError,
15947
"function's dictionary may not be deleted");
15948
return -1;
15949
}
15950
if (unlikely(!PyDict_Check(value))) {
15951
PyErr_SetString(PyExc_TypeError,
15952
"setting function's dictionary to a non-dict");
15953
return -1;
15954
}
15955
tmp = op->func_dict;
15956
Py_INCREF(value);
15957
op->func_dict = value;
15958
Py_XDECREF(tmp);
15959
return 0;
15960
}
15961
static PyObject *
15962
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
15963
{
15964
Py_INCREF(op->func_globals);
15965
return op->func_globals;
15966
}
15967
static PyObject *
15968
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
15969
{
15970
Py_INCREF(Py_None);
15971
return Py_None;
15972
}
15973
static PyObject *
15974
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
15975
{
15976
PyObject* result = (op->func_code) ? op->func_code : Py_None;
15977
Py_INCREF(result);
15978
return result;
15979
}
15980
static int
15981
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
15982
int result = 0;
15983
PyObject *res = op->defaults_getter((PyObject *) op);
15984
if (unlikely(!res))
15985
return -1;
15986
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15987
op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
15988
Py_INCREF(op->defaults_tuple);
15989
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
15990
Py_INCREF(op->defaults_kwdict);
15991
#else
15992
op->defaults_tuple = PySequence_ITEM(res, 0);
15993
if (unlikely(!op->defaults_tuple)) result = -1;
15994
else {
15995
op->defaults_kwdict = PySequence_ITEM(res, 1);
15996
if (unlikely(!op->defaults_kwdict)) result = -1;
15997
}
15998
#endif
15999
Py_DECREF(res);
16000
return result;
16001
}
16002
static int
16003
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
16004
PyObject* tmp;
16005
if (!value) {
16006
value = Py_None;
16007
} else if (value != Py_None && !PyTuple_Check(value)) {
16008
PyErr_SetString(PyExc_TypeError,
16009
"__defaults__ must be set to a tuple object");
16010
return -1;
16011
}
16012
Py_INCREF(value);
16013
tmp = op->defaults_tuple;
16014
op->defaults_tuple = value;
16015
Py_XDECREF(tmp);
16016
return 0;
16017
}
16018
static PyObject *
16019
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
16020
PyObject* result = op->defaults_tuple;
16021
if (unlikely(!result)) {
16022
if (op->defaults_getter) {
16023
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
16024
result = op->defaults_tuple;
16025
} else {
16026
result = Py_None;
16027
}
16028
}
16029
Py_INCREF(result);
16030
return result;
16031
}
16032
static int
16033
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
16034
PyObject* tmp;
16035
if (!value) {
16036
value = Py_None;
16037
} else if (value != Py_None && !PyDict_Check(value)) {
16038
PyErr_SetString(PyExc_TypeError,
16039
"__kwdefaults__ must be set to a dict object");
16040
return -1;
16041
}
16042
Py_INCREF(value);
16043
tmp = op->defaults_kwdict;
16044
op->defaults_kwdict = value;
16045
Py_XDECREF(tmp);
16046
return 0;
16047
}
16048
static PyObject *
16049
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
16050
PyObject* result = op->defaults_kwdict;
16051
if (unlikely(!result)) {
16052
if (op->defaults_getter) {
16053
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
16054
result = op->defaults_kwdict;
16055
} else {
16056
result = Py_None;
16057
}
16058
}
16059
Py_INCREF(result);
16060
return result;
16061
}
16062
static int
16063
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
16064
PyObject* tmp;
16065
if (!value || value == Py_None) {
16066
value = NULL;
16067
} else if (!PyDict_Check(value)) {
16068
PyErr_SetString(PyExc_TypeError,
16069
"__annotations__ must be set to a dict object");
16070
return -1;
16071
}
16072
Py_XINCREF(value);
16073
tmp = op->func_annotations;
16074
op->func_annotations = value;
16075
Py_XDECREF(tmp);
16076
return 0;
16077
}
16078
static PyObject *
16079
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
16080
PyObject* result = op->func_annotations;
16081
if (unlikely(!result)) {
16082
result = PyDict_New();
16083
if (unlikely(!result)) return NULL;
16084
op->func_annotations = result;
16085
}
16086
Py_INCREF(result);
16087
return result;
16088
}
16089
static PyGetSetDef __pyx_CyFunction_getsets[] = {
16090
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
16091
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
16092
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
16093
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
16094
{(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
16095
{(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
16096
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
16097
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
16098
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
16099
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
16100
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
16101
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
16102
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
16103
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
16104
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
16105
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
16106
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
16107
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
16108
{0, 0, 0, 0, 0}
16109
};
16110
static PyMemberDef __pyx_CyFunction_members[] = {
16111
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
16112
{0, 0, 0, 0, 0}
16113
};
16114
static PyObject *
16115
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
16116
{
16117
#if PY_MAJOR_VERSION >= 3
16118
return PyUnicode_FromString(m->func.m_ml->ml_name);
16119
#else
16120
return PyString_FromString(m->func.m_ml->ml_name);
16121
#endif
16122
}
16123
static PyMethodDef __pyx_CyFunction_methods[] = {
16124
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
16125
{0, 0, 0, 0}
16126
};
16127
#if PY_VERSION_HEX < 0x030500A0
16128
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
16129
#else
16130
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
16131
#endif
16132
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
16133
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
16134
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
16135
if (op == NULL)
16136
return NULL;
16137
op->flags = flags;
16138
__Pyx_CyFunction_weakreflist(op) = NULL;
16139
op->func.m_ml = ml;
16140
op->func.m_self = (PyObject *) op;
16141
Py_XINCREF(closure);
16142
op->func_closure = closure;
16143
Py_XINCREF(module);
16144
op->func.m_module = module;
16145
op->func_dict = NULL;
16146
op->func_name = NULL;
16147
Py_INCREF(qualname);
16148
op->func_qualname = qualname;
16149
op->func_doc = NULL;
16150
op->func_classobj = NULL;
16151
op->func_globals = globals;
16152
Py_INCREF(op->func_globals);
16153
Py_XINCREF(code);
16154
op->func_code = code;
16155
op->defaults_pyobjects = 0;
16156
op->defaults = NULL;
16157
op->defaults_tuple = NULL;
16158
op->defaults_kwdict = NULL;
16159
op->defaults_getter = NULL;
16160
op->func_annotations = NULL;
16161
PyObject_GC_Track(op);
16162
return (PyObject *) op;
16163
}
16164
static int
16165
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
16166
{
16167
Py_CLEAR(m->func_closure);
16168
Py_CLEAR(m->func.m_module);
16169
Py_CLEAR(m->func_dict);
16170
Py_CLEAR(m->func_name);
16171
Py_CLEAR(m->func_qualname);
16172
Py_CLEAR(m->func_doc);
16173
Py_CLEAR(m->func_globals);
16174
Py_CLEAR(m->func_code);
16175
Py_CLEAR(m->func_classobj);
16176
Py_CLEAR(m->defaults_tuple);
16177
Py_CLEAR(m->defaults_kwdict);
16178
Py_CLEAR(m->func_annotations);
16179
if (m->defaults) {
16180
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
16181
int i;
16182
for (i = 0; i < m->defaults_pyobjects; i++)
16183
Py_XDECREF(pydefaults[i]);
16184
PyObject_Free(m->defaults);
16185
m->defaults = NULL;
16186
}
16187
return 0;
16188
}
16189
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
16190
{
16191
PyObject_GC_UnTrack(m);
16192
if (__Pyx_CyFunction_weakreflist(m) != NULL)
16193
PyObject_ClearWeakRefs((PyObject *) m);
16194
__Pyx_CyFunction_clear(m);
16195
PyObject_GC_Del(m);
16196
}
16197
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
16198
{
16199
Py_VISIT(m->func_closure);
16200
Py_VISIT(m->func.m_module);
16201
Py_VISIT(m->func_dict);
16202
Py_VISIT(m->func_name);
16203
Py_VISIT(m->func_qualname);
16204
Py_VISIT(m->func_doc);
16205
Py_VISIT(m->func_globals);
16206
Py_VISIT(m->func_code);
16207
Py_VISIT(m->func_classobj);
16208
Py_VISIT(m->defaults_tuple);
16209
Py_VISIT(m->defaults_kwdict);
16210
if (m->defaults) {
16211
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
16212
int i;
16213
for (i = 0; i < m->defaults_pyobjects; i++)
16214
Py_VISIT(pydefaults[i]);
16215
}
16216
return 0;
16217
}
16218
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
16219
{
16220
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16221
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
16222
Py_INCREF(func);
16223
return func;
16224
}
16225
if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
16226
if (type == NULL)
16227
type = (PyObject *)(Py_TYPE(obj));
16228
return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
16229
}
16230
if (obj == Py_None)
16231
obj = NULL;
16232
return __Pyx_PyMethod_New(func, obj, type);
16233
}
16234
static PyObject*
16235
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
16236
{
16237
#if PY_MAJOR_VERSION >= 3
16238
return PyUnicode_FromFormat("<cyfunction %U at %p>",
16239
op->func_qualname, (void *)op);
16240
#else
16241
return PyString_FromFormat("<cyfunction %s at %p>",
16242
PyString_AsString(op->func_qualname), (void *)op);
16243
#endif
16244
}
16245
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
16246
PyCFunctionObject* f = (PyCFunctionObject*)func;
16247
PyCFunction meth = f->m_ml->ml_meth;
16248
Py_ssize_t size;
16249
switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
16250
case METH_VARARGS:
16251
if (likely(kw == NULL || PyDict_Size(kw) == 0))
16252
return (*meth)(self, arg);
16253
break;
16254
case METH_VARARGS | METH_KEYWORDS:
16255
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
16256
case METH_NOARGS:
16257
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
16258
size = PyTuple_GET_SIZE(arg);
16259
if (likely(size == 0))
16260
return (*meth)(self, NULL);
16261
PyErr_Format(PyExc_TypeError,
16262
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
16263
f->m_ml->ml_name, size);
16264
return NULL;
16265
}
16266
break;
16267
case METH_O:
16268
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
16269
size = PyTuple_GET_SIZE(arg);
16270
if (likely(size == 1)) {
16271
PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
16272
if (unlikely(!arg0)) return NULL;
16273
result = (*meth)(self, arg0);
16274
Py_DECREF(arg0);
16275
return result;
16276
}
16277
PyErr_Format(PyExc_TypeError,
16278
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
16279
f->m_ml->ml_name, size);
16280
return NULL;
16281
}
16282
break;
16283
default:
16284
PyErr_SetString(PyExc_SystemError, "Bad call flags in "
16285
"__Pyx_CyFunction_Call. METH_OLDARGS is no "
16286
"longer supported!");
16287
return NULL;
16288
}
16289
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
16290
f->m_ml->ml_name);
16291
return NULL;
16292
}
16293
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
16294
return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
16295
}
16296
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
16297
PyObject *result;
16298
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
16299
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
16300
Py_ssize_t argc;
16301
PyObject *new_args;
16302
PyObject *self;
16303
argc = PyTuple_GET_SIZE(args);
16304
new_args = PyTuple_GetSlice(args, 1, argc);
16305
if (unlikely(!new_args))
16306
return NULL;
16307
self = PyTuple_GetItem(args, 0);
16308
if (unlikely(!self)) {
16309
Py_DECREF(new_args);
16310
return NULL;
16311
}
16312
result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
16313
Py_DECREF(new_args);
16314
} else {
16315
result = __Pyx_CyFunction_Call(func, args, kw);
16316
}
16317
return result;
16318
}
16319
static PyTypeObject __pyx_CyFunctionType_type = {
16320
PyVarObject_HEAD_INIT(0, 0)
16321
"cython_function_or_method",
16322
sizeof(__pyx_CyFunctionObject),
16323
0,
16324
(destructor) __Pyx_CyFunction_dealloc,
16325
0,
16326
0,
16327
0,
16328
#if PY_MAJOR_VERSION < 3
16329
0,
16330
#else
16331
0,
16332
#endif
16333
(reprfunc) __Pyx_CyFunction_repr,
16334
0,
16335
0,
16336
0,
16337
0,
16338
__Pyx_CyFunction_CallAsMethod,
16339
0,
16340
0,
16341
0,
16342
0,
16343
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
16344
0,
16345
(traverseproc) __Pyx_CyFunction_traverse,
16346
(inquiry) __Pyx_CyFunction_clear,
16347
0,
16348
#if PY_VERSION_HEX < 0x030500A0
16349
offsetof(__pyx_CyFunctionObject, func_weakreflist),
16350
#else
16351
offsetof(PyCFunctionObject, m_weakreflist),
16352
#endif
16353
0,
16354
0,
16355
__pyx_CyFunction_methods,
16356
__pyx_CyFunction_members,
16357
__pyx_CyFunction_getsets,
16358
0,
16359
0,
16360
__Pyx_CyFunction_descr_get,
16361
0,
16362
offsetof(__pyx_CyFunctionObject, func_dict),
16363
0,
16364
0,
16365
0,
16366
0,
16367
0,
16368
0,
16369
0,
16370
0,
16371
0,
16372
0,
16373
0,
16374
0,
16375
#if PY_VERSION_HEX >= 0x030400a1
16376
0,
16377
#endif
16378
};
16379
static int __pyx_CyFunction_init(void) {
16380
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
16381
if (__pyx_CyFunctionType == NULL) {
16382
return -1;
16383
}
16384
return 0;
16385
}
16386
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
16387
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16388
m->defaults = PyObject_Malloc(size);
16389
if (!m->defaults)
16390
return PyErr_NoMemory();
16391
memset(m->defaults, 0, size);
16392
m->defaults_pyobjects = pyobjects;
16393
return m->defaults;
16394
}
16395
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
16396
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16397
m->defaults_tuple = tuple;
16398
Py_INCREF(tuple);
16399
}
16400
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
16401
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16402
m->defaults_kwdict = dict;
16403
Py_INCREF(dict);
16404
}
16405
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
16406
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
16407
m->func_annotations = dict;
16408
Py_INCREF(dict);
16409
}
16410
16411
/* SetVTable */
16412
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
16413
#if PY_VERSION_HEX >= 0x02070000
16414
PyObject *ob = PyCapsule_New(vtable, 0, 0);
16415
#else
16416
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
16417
#endif
16418
if (!ob)
16419
goto bad;
16420
if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
16421
goto bad;
16422
Py_DECREF(ob);
16423
return 0;
16424
bad:
16425
Py_XDECREF(ob);
16426
return -1;
16427
}
16428
16429
/* GetVTable */
16430
static void* __Pyx_GetVtable(PyObject *dict) {
16431
void* ptr;
16432
PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
16433
if (!ob)
16434
goto bad;
16435
#if PY_VERSION_HEX >= 0x02070000
16436
ptr = PyCapsule_GetPointer(ob, 0);
16437
#else
16438
ptr = PyCObject_AsVoidPtr(ob);
16439
#endif
16440
if (!ptr && !PyErr_Occurred())
16441
PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
16442
Py_DECREF(ob);
16443
return ptr;
16444
bad:
16445
Py_XDECREF(ob);
16446
return NULL;
16447
}
16448
16449
/* CodeObjectCache */
16450
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
16451
int start = 0, mid = 0, end = count - 1;
16452
if (end >= 0 && code_line > entries[end].code_line) {
16453
return count;
16454
}
16455
while (start < end) {
16456
mid = start + (end - start) / 2;
16457
if (code_line < entries[mid].code_line) {
16458
end = mid;
16459
} else if (code_line > entries[mid].code_line) {
16460
start = mid + 1;
16461
} else {
16462
return mid;
16463
}
16464
}
16465
if (code_line <= entries[mid].code_line) {
16466
return mid;
16467
} else {
16468
return mid + 1;
16469
}
16470
}
16471
static PyCodeObject *__pyx_find_code_object(int code_line) {
16472
PyCodeObject* code_object;
16473
int pos;
16474
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
16475
return NULL;
16476
}
16477
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16478
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
16479
return NULL;
16480
}
16481
code_object = __pyx_code_cache.entries[pos].code_object;
16482
Py_INCREF(code_object);
16483
return code_object;
16484
}
16485
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
16486
int pos, i;
16487
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
16488
if (unlikely(!code_line)) {
16489
return;
16490
}
16491
if (unlikely(!entries)) {
16492
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
16493
if (likely(entries)) {
16494
__pyx_code_cache.entries = entries;
16495
__pyx_code_cache.max_count = 64;
16496
__pyx_code_cache.count = 1;
16497
entries[0].code_line = code_line;
16498
entries[0].code_object = code_object;
16499
Py_INCREF(code_object);
16500
}
16501
return;
16502
}
16503
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
16504
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
16505
PyCodeObject* tmp = entries[pos].code_object;
16506
entries[pos].code_object = code_object;
16507
Py_DECREF(tmp);
16508
return;
16509
}
16510
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
16511
int new_max = __pyx_code_cache.max_count + 64;
16512
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
16513
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
16514
if (unlikely(!entries)) {
16515
return;
16516
}
16517
__pyx_code_cache.entries = entries;
16518
__pyx_code_cache.max_count = new_max;
16519
}
16520
for (i=__pyx_code_cache.count; i>pos; i--) {
16521
entries[i] = entries[i-1];
16522
}
16523
entries[pos].code_line = code_line;
16524
entries[pos].code_object = code_object;
16525
__pyx_code_cache.count++;
16526
Py_INCREF(code_object);
16527
}
16528
16529
/* AddTraceback */
16530
#include "compile.h"
16531
#include "frameobject.h"
16532
#include "traceback.h"
16533
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
16534
const char *funcname, int c_line,
16535
int py_line, const char *filename) {
16536
PyCodeObject *py_code = 0;
16537
PyObject *py_srcfile = 0;
16538
PyObject *py_funcname = 0;
16539
#if PY_MAJOR_VERSION < 3
16540
py_srcfile = PyString_FromString(filename);
16541
#else
16542
py_srcfile = PyUnicode_FromString(filename);
16543
#endif
16544
if (!py_srcfile) goto bad;
16545
if (c_line) {
16546
#if PY_MAJOR_VERSION < 3
16547
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16548
#else
16549
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
16550
#endif
16551
}
16552
else {
16553
#if PY_MAJOR_VERSION < 3
16554
py_funcname = PyString_FromString(funcname);
16555
#else
16556
py_funcname = PyUnicode_FromString(funcname);
16557
#endif
16558
}
16559
if (!py_funcname) goto bad;
16560
py_code = __Pyx_PyCode_New(
16561
0,
16562
0,
16563
0,
16564
0,
16565
0,
16566
__pyx_empty_bytes, /*PyObject *code,*/
16567
__pyx_empty_tuple, /*PyObject *consts,*/
16568
__pyx_empty_tuple, /*PyObject *names,*/
16569
__pyx_empty_tuple, /*PyObject *varnames,*/
16570
__pyx_empty_tuple, /*PyObject *freevars,*/
16571
__pyx_empty_tuple, /*PyObject *cellvars,*/
16572
py_srcfile, /*PyObject *filename,*/
16573
py_funcname, /*PyObject *name,*/
16574
py_line,
16575
__pyx_empty_bytes /*PyObject *lnotab*/
16576
);
16577
Py_DECREF(py_srcfile);
16578
Py_DECREF(py_funcname);
16579
return py_code;
16580
bad:
16581
Py_XDECREF(py_srcfile);
16582
Py_XDECREF(py_funcname);
16583
return NULL;
16584
}
16585
static void __Pyx_AddTraceback(const char *funcname, int c_line,
16586
int py_line, const char *filename) {
16587
PyCodeObject *py_code = 0;
16588
PyFrameObject *py_frame = 0;
16589
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
16590
if (!py_code) {
16591
py_code = __Pyx_CreateCodeObjectForTraceback(
16592
funcname, c_line, py_line, filename);
16593
if (!py_code) goto bad;
16594
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
16595
}
16596
py_frame = PyFrame_New(
16597
PyThreadState_GET(), /*PyThreadState *tstate,*/
16598
py_code, /*PyCodeObject *code,*/
16599
__pyx_d, /*PyObject *globals,*/
16600
0 /*PyObject *locals*/
16601
);
16602
if (!py_frame) goto bad;
16603
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
16604
PyTraceBack_Here(py_frame);
16605
bad:
16606
Py_XDECREF(py_code);
16607
Py_XDECREF(py_frame);
16608
}
16609
16610
/* CIntFromPyVerify */
16611
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
16612
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
16613
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
16614
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
16615
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
16616
{\
16617
func_type value = func_value;\
16618
if (sizeof(target_type) < sizeof(func_type)) {\
16619
if (unlikely(value != (func_type) (target_type) value)) {\
16620
func_type zero = 0;\
16621
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
16622
return (target_type) -1;\
16623
if (is_unsigned && unlikely(value < zero))\
16624
goto raise_neg_overflow;\
16625
else\
16626
goto raise_overflow;\
16627
}\
16628
}\
16629
return (target_type) value;\
16630
}
16631
16632
/* CIntToPy */
16633
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
16634
const long neg_one = (long) -1, const_zero = (long) 0;
16635
const int is_unsigned = neg_one > const_zero;
16636
if (is_unsigned) {
16637
if (sizeof(long) < sizeof(long)) {
16638
return PyInt_FromLong((long) value);
16639
} else if (sizeof(long) <= sizeof(unsigned long)) {
16640
return PyLong_FromUnsignedLong((unsigned long) value);
16641
#ifdef HAVE_LONG_LONG
16642
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16643
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16644
#endif
16645
}
16646
} else {
16647
if (sizeof(long) <= sizeof(long)) {
16648
return PyInt_FromLong((long) value);
16649
#ifdef HAVE_LONG_LONG
16650
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
16651
return PyLong_FromLongLong((PY_LONG_LONG) value);
16652
#endif
16653
}
16654
}
16655
{
16656
int one = 1; int little = (int)*(unsigned char *)&one;
16657
unsigned char *bytes = (unsigned char *)&value;
16658
return _PyLong_FromByteArray(bytes, sizeof(long),
16659
little, !is_unsigned);
16660
}
16661
}
16662
16663
/* CIntToPy */
16664
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
16665
const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
16666
const int is_unsigned = neg_one > const_zero;
16667
if (is_unsigned) {
16668
if (sizeof(unsigned long) < sizeof(long)) {
16669
return PyInt_FromLong((long) value);
16670
} else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
16671
return PyLong_FromUnsignedLong((unsigned long) value);
16672
#ifdef HAVE_LONG_LONG
16673
} else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
16674
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16675
#endif
16676
}
16677
} else {
16678
if (sizeof(unsigned long) <= sizeof(long)) {
16679
return PyInt_FromLong((long) value);
16680
#ifdef HAVE_LONG_LONG
16681
} else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
16682
return PyLong_FromLongLong((PY_LONG_LONG) value);
16683
#endif
16684
}
16685
}
16686
{
16687
int one = 1; int little = (int)*(unsigned char *)&one;
16688
unsigned char *bytes = (unsigned char *)&value;
16689
return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
16690
little, !is_unsigned);
16691
}
16692
}
16693
16694
/* CIntToPy */
16695
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
16696
const int neg_one = (int) -1, const_zero = (int) 0;
16697
const int is_unsigned = neg_one > const_zero;
16698
if (is_unsigned) {
16699
if (sizeof(int) < sizeof(long)) {
16700
return PyInt_FromLong((long) value);
16701
} else if (sizeof(int) <= sizeof(unsigned long)) {
16702
return PyLong_FromUnsignedLong((unsigned long) value);
16703
#ifdef HAVE_LONG_LONG
16704
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
16705
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
16706
#endif
16707
}
16708
} else {
16709
if (sizeof(int) <= sizeof(long)) {
16710
return PyInt_FromLong((long) value);
16711
#ifdef HAVE_LONG_LONG
16712
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
16713
return PyLong_FromLongLong((PY_LONG_LONG) value);
16714
#endif
16715
}
16716
}
16717
{
16718
int one = 1; int little = (int)*(unsigned char *)&one;
16719
unsigned char *bytes = (unsigned char *)&value;
16720
return _PyLong_FromByteArray(bytes, sizeof(int),
16721
little, !is_unsigned);
16722
}
16723
}
16724
16725
/* CIntFromPy */
16726
static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) {
16727
const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
16728
const int is_unsigned = neg_one > const_zero;
16729
#if PY_MAJOR_VERSION < 3
16730
if (likely(PyInt_Check(x))) {
16731
if (sizeof(unsigned long) < sizeof(long)) {
16732
__PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x))
16733
} else {
16734
long val = PyInt_AS_LONG(x);
16735
if (is_unsigned && unlikely(val < 0)) {
16736
goto raise_neg_overflow;
16737
}
16738
return (unsigned long) val;
16739
}
16740
} else
16741
#endif
16742
if (likely(PyLong_Check(x))) {
16743
if (is_unsigned) {
16744
#if CYTHON_USE_PYLONG_INTERNALS
16745
const digit* digits = ((PyLongObject*)x)->ob_digit;
16746
switch (Py_SIZE(x)) {
16747
case 0: return (unsigned long) 0;
16748
case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, digits[0])
16749
case 2:
16750
if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
16751
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16752
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16753
} else if (8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT) {
16754
return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
16755
}
16756
}
16757
break;
16758
case 3:
16759
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16760
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16761
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16762
} else if (8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT) {
16763
return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
16764
}
16765
}
16766
break;
16767
case 4:
16768
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16769
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16770
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16771
} else if (8 * sizeof(unsigned long) >= 4 * PyLong_SHIFT) {
16772
return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
16773
}
16774
}
16775
break;
16776
}
16777
#endif
16778
#if CYTHON_COMPILING_IN_CPYTHON
16779
if (unlikely(Py_SIZE(x) < 0)) {
16780
goto raise_neg_overflow;
16781
}
16782
#else
16783
{
16784
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16785
if (unlikely(result < 0))
16786
return (unsigned long) -1;
16787
if (unlikely(result == 1))
16788
goto raise_neg_overflow;
16789
}
16790
#endif
16791
if (sizeof(unsigned long) <= sizeof(unsigned long)) {
16792
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
16793
#ifdef HAVE_LONG_LONG
16794
} else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
16795
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16796
#endif
16797
}
16798
} else {
16799
#if CYTHON_USE_PYLONG_INTERNALS
16800
const digit* digits = ((PyLongObject*)x)->ob_digit;
16801
switch (Py_SIZE(x)) {
16802
case 0: return (unsigned long) 0;
16803
case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, (sdigit) (-(sdigit)digits[0]))
16804
case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, +digits[0])
16805
case -2:
16806
if (8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT) {
16807
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16808
__PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16809
} else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
16810
return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
16811
}
16812
}
16813
break;
16814
case 2:
16815
if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
16816
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16817
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16818
} else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
16819
return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
16820
}
16821
}
16822
break;
16823
case -3:
16824
if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
16825
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16826
__PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16827
} else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
16828
return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
16829
}
16830
}
16831
break;
16832
case 3:
16833
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16834
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16835
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16836
} else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
16837
return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
16838
}
16839
}
16840
break;
16841
case -4:
16842
if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
16843
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16844
__PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16845
} else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) {
16846
return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
16847
}
16848
}
16849
break;
16850
case 4:
16851
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16852
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16853
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16854
} else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) {
16855
return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
16856
}
16857
}
16858
break;
16859
}
16860
#endif
16861
if (sizeof(unsigned long) <= sizeof(long)) {
16862
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
16863
#ifdef HAVE_LONG_LONG
16864
} else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
16865
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x))
16866
#endif
16867
}
16868
}
16869
{
16870
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
16871
PyErr_SetString(PyExc_RuntimeError,
16872
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
16873
#else
16874
unsigned long val;
16875
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
16876
#if PY_MAJOR_VERSION < 3
16877
if (likely(v) && !PyLong_Check(v)) {
16878
PyObject *tmp = v;
16879
v = PyNumber_Long(tmp);
16880
Py_DECREF(tmp);
16881
}
16882
#endif
16883
if (likely(v)) {
16884
int one = 1; int is_little = (int)*(unsigned char *)&one;
16885
unsigned char *bytes = (unsigned char *)&val;
16886
int ret = _PyLong_AsByteArray((PyLongObject *)v,
16887
bytes, sizeof(val),
16888
is_little, !is_unsigned);
16889
Py_DECREF(v);
16890
if (likely(!ret))
16891
return val;
16892
}
16893
#endif
16894
return (unsigned long) -1;
16895
}
16896
} else {
16897
unsigned long val;
16898
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
16899
if (!tmp) return (unsigned long) -1;
16900
val = __Pyx_PyInt_As_unsigned_long(tmp);
16901
Py_DECREF(tmp);
16902
return val;
16903
}
16904
raise_overflow:
16905
PyErr_SetString(PyExc_OverflowError,
16906
"value too large to convert to unsigned long");
16907
return (unsigned long) -1;
16908
raise_neg_overflow:
16909
PyErr_SetString(PyExc_OverflowError,
16910
"can't convert negative value to unsigned long");
16911
return (unsigned long) -1;
16912
}
16913
16914
/* CIntFromPy */
16915
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
16916
const long neg_one = (long) -1, const_zero = (long) 0;
16917
const int is_unsigned = neg_one > const_zero;
16918
#if PY_MAJOR_VERSION < 3
16919
if (likely(PyInt_Check(x))) {
16920
if (sizeof(long) < sizeof(long)) {
16921
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
16922
} else {
16923
long val = PyInt_AS_LONG(x);
16924
if (is_unsigned && unlikely(val < 0)) {
16925
goto raise_neg_overflow;
16926
}
16927
return (long) val;
16928
}
16929
} else
16930
#endif
16931
if (likely(PyLong_Check(x))) {
16932
if (is_unsigned) {
16933
#if CYTHON_USE_PYLONG_INTERNALS
16934
const digit* digits = ((PyLongObject*)x)->ob_digit;
16935
switch (Py_SIZE(x)) {
16936
case 0: return (long) 0;
16937
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
16938
case 2:
16939
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
16940
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16941
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16942
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
16943
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16944
}
16945
}
16946
break;
16947
case 3:
16948
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
16949
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
16950
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16951
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
16952
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16953
}
16954
}
16955
break;
16956
case 4:
16957
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
16958
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
16959
__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])))
16960
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
16961
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
16962
}
16963
}
16964
break;
16965
}
16966
#endif
16967
#if CYTHON_COMPILING_IN_CPYTHON
16968
if (unlikely(Py_SIZE(x) < 0)) {
16969
goto raise_neg_overflow;
16970
}
16971
#else
16972
{
16973
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
16974
if (unlikely(result < 0))
16975
return (long) -1;
16976
if (unlikely(result == 1))
16977
goto raise_neg_overflow;
16978
}
16979
#endif
16980
if (sizeof(long) <= sizeof(unsigned long)) {
16981
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
16982
#ifdef HAVE_LONG_LONG
16983
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
16984
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
16985
#endif
16986
}
16987
} else {
16988
#if CYTHON_USE_PYLONG_INTERNALS
16989
const digit* digits = ((PyLongObject*)x)->ob_digit;
16990
switch (Py_SIZE(x)) {
16991
case 0: return (long) 0;
16992
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
16993
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
16994
case -2:
16995
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
16996
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
16997
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
16998
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
16999
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17000
}
17001
}
17002
break;
17003
case 2:
17004
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
17005
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
17006
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17007
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
17008
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17009
}
17010
}
17011
break;
17012
case -3:
17013
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
17014
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
17015
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17016
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
17017
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17018
}
17019
}
17020
break;
17021
case 3:
17022
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
17023
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
17024
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17025
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
17026
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17027
}
17028
}
17029
break;
17030
case -4:
17031
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
17032
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
17033
__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])))
17034
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
17035
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17036
}
17037
}
17038
break;
17039
case 4:
17040
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
17041
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
17042
__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])))
17043
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
17044
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
17045
}
17046
}
17047
break;
17048
}
17049
#endif
17050
if (sizeof(long) <= sizeof(long)) {
17051
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
17052
#ifdef HAVE_LONG_LONG
17053
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
17054
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
17055
#endif
17056
}
17057
}
17058
{
17059
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
17060
PyErr_SetString(PyExc_RuntimeError,
17061
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
17062
#else
17063
long val;
17064
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
17065
#if PY_MAJOR_VERSION < 3
17066
if (likely(v) && !PyLong_Check(v)) {
17067
PyObject *tmp = v;
17068
v = PyNumber_Long(tmp);
17069
Py_DECREF(tmp);
17070
}
17071
#endif
17072
if (likely(v)) {
17073
int one = 1; int is_little = (int)*(unsigned char *)&one;
17074
unsigned char *bytes = (unsigned char *)&val;
17075
int ret = _PyLong_AsByteArray((PyLongObject *)v,
17076
bytes, sizeof(val),
17077
is_little, !is_unsigned);
17078
Py_DECREF(v);
17079
if (likely(!ret))
17080
return val;
17081
}
17082
#endif
17083
return (long) -1;
17084
}
17085
} else {
17086
long val;
17087
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
17088
if (!tmp) return (long) -1;
17089
val = __Pyx_PyInt_As_long(tmp);
17090
Py_DECREF(tmp);
17091
return val;
17092
}
17093
raise_overflow:
17094
PyErr_SetString(PyExc_OverflowError,
17095
"value too large to convert to long");
17096
return (long) -1;
17097
raise_neg_overflow:
17098
PyErr_SetString(PyExc_OverflowError,
17099
"can't convert negative value to long");
17100
return (long) -1;
17101
}
17102
17103
/* CIntFromPy */
17104
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
17105
const int neg_one = (int) -1, const_zero = (int) 0;
17106
const int is_unsigned = neg_one > const_zero;
17107
#if PY_MAJOR_VERSION < 3
17108
if (likely(PyInt_Check(x))) {
17109
if (sizeof(int) < sizeof(long)) {
17110
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
17111
} else {
17112
long val = PyInt_AS_LONG(x);
17113
if (is_unsigned && unlikely(val < 0)) {
17114
goto raise_neg_overflow;
17115
}
17116
return (int) val;
17117
}
17118
} else
17119
#endif
17120
if (likely(PyLong_Check(x))) {
17121
if (is_unsigned) {
17122
#if CYTHON_USE_PYLONG_INTERNALS
17123
const digit* digits = ((PyLongObject*)x)->ob_digit;
17124
switch (Py_SIZE(x)) {
17125
case 0: return (int) 0;
17126
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
17127
case 2:
17128
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
17129
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
17130
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17131
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
17132
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
17133
}
17134
}
17135
break;
17136
case 3:
17137
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
17138
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
17139
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17140
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
17141
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
17142
}
17143
}
17144
break;
17145
case 4:
17146
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
17147
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
17148
__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])))
17149
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
17150
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
17151
}
17152
}
17153
break;
17154
}
17155
#endif
17156
#if CYTHON_COMPILING_IN_CPYTHON
17157
if (unlikely(Py_SIZE(x) < 0)) {
17158
goto raise_neg_overflow;
17159
}
17160
#else
17161
{
17162
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
17163
if (unlikely(result < 0))
17164
return (int) -1;
17165
if (unlikely(result == 1))
17166
goto raise_neg_overflow;
17167
}
17168
#endif
17169
if (sizeof(int) <= sizeof(unsigned long)) {
17170
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
17171
#ifdef HAVE_LONG_LONG
17172
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
17173
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
17174
#endif
17175
}
17176
} else {
17177
#if CYTHON_USE_PYLONG_INTERNALS
17178
const digit* digits = ((PyLongObject*)x)->ob_digit;
17179
switch (Py_SIZE(x)) {
17180
case 0: return (int) 0;
17181
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
17182
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
17183
case -2:
17184
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
17185
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
17186
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17187
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
17188
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
17189
}
17190
}
17191
break;
17192
case 2:
17193
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
17194
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
17195
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17196
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
17197
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
17198
}
17199
}
17200
break;
17201
case -3:
17202
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
17203
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
17204
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17205
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
17206
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
17207
}
17208
}
17209
break;
17210
case 3:
17211
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
17212
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
17213
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
17214
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
17215
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
17216
}
17217
}
17218
break;
17219
case -4:
17220
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
17221
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
17222
__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])))
17223
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
17224
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
17225
}
17226
}
17227
break;
17228
case 4:
17229
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
17230
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
17231
__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])))
17232
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
17233
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
17234
}
17235
}
17236
break;
17237
}
17238
#endif
17239
if (sizeof(int) <= sizeof(long)) {
17240
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
17241
#ifdef HAVE_LONG_LONG
17242
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
17243
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
17244
#endif
17245
}
17246
}
17247
{
17248
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
17249
PyErr_SetString(PyExc_RuntimeError,
17250
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
17251
#else
17252
int val;
17253
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
17254
#if PY_MAJOR_VERSION < 3
17255
if (likely(v) && !PyLong_Check(v)) {
17256
PyObject *tmp = v;
17257
v = PyNumber_Long(tmp);
17258
Py_DECREF(tmp);
17259
}
17260
#endif
17261
if (likely(v)) {
17262
int one = 1; int is_little = (int)*(unsigned char *)&one;
17263
unsigned char *bytes = (unsigned char *)&val;
17264
int ret = _PyLong_AsByteArray((PyLongObject *)v,
17265
bytes, sizeof(val),
17266
is_little, !is_unsigned);
17267
Py_DECREF(v);
17268
if (likely(!ret))
17269
return val;
17270
}
17271
#endif
17272
return (int) -1;
17273
}
17274
} else {
17275
int val;
17276
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
17277
if (!tmp) return (int) -1;
17278
val = __Pyx_PyInt_As_int(tmp);
17279
Py_DECREF(tmp);
17280
return val;
17281
}
17282
raise_overflow:
17283
PyErr_SetString(PyExc_OverflowError,
17284
"value too large to convert to int");
17285
return (int) -1;
17286
raise_neg_overflow:
17287
PyErr_SetString(PyExc_OverflowError,
17288
"can't convert negative value to int");
17289
return (int) -1;
17290
}
17291
17292
/* CheckBinaryVersion */
17293
static int __Pyx_check_binary_version(void) {
17294
char ctversion[4], rtversion[4];
17295
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
17296
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
17297
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
17298
char message[200];
17299
PyOS_snprintf(message, sizeof(message),
17300
"compiletime version %s of module '%.100s' "
17301
"does not match runtime version %s",
17302
ctversion, __Pyx_MODULE_NAME, rtversion);
17303
return PyErr_WarnEx(NULL, message, 1);
17304
}
17305
return 0;
17306
}
17307
17308
/* ModuleImport */
17309
#ifndef __PYX_HAVE_RT_ImportModule
17310
#define __PYX_HAVE_RT_ImportModule
17311
static PyObject *__Pyx_ImportModule(const char *name) {
17312
PyObject *py_name = 0;
17313
PyObject *py_module = 0;
17314
py_name = __Pyx_PyIdentifier_FromString(name);
17315
if (!py_name)
17316
goto bad;
17317
py_module = PyImport_Import(py_name);
17318
Py_DECREF(py_name);
17319
return py_module;
17320
bad:
17321
Py_XDECREF(py_name);
17322
return 0;
17323
}
17324
#endif
17325
17326
/* TypeImport */
17327
#ifndef __PYX_HAVE_RT_ImportType
17328
#define __PYX_HAVE_RT_ImportType
17329
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
17330
size_t size, int strict)
17331
{
17332
PyObject *py_module = 0;
17333
PyObject *result = 0;
17334
PyObject *py_name = 0;
17335
char warning[200];
17336
Py_ssize_t basicsize;
17337
#ifdef Py_LIMITED_API
17338
PyObject *py_basicsize;
17339
#endif
17340
py_module = __Pyx_ImportModule(module_name);
17341
if (!py_module)
17342
goto bad;
17343
py_name = __Pyx_PyIdentifier_FromString(class_name);
17344
if (!py_name)
17345
goto bad;
17346
result = PyObject_GetAttr(py_module, py_name);
17347
Py_DECREF(py_name);
17348
py_name = 0;
17349
Py_DECREF(py_module);
17350
py_module = 0;
17351
if (!result)
17352
goto bad;
17353
if (!PyType_Check(result)) {
17354
PyErr_Format(PyExc_TypeError,
17355
"%.200s.%.200s is not a type object",
17356
module_name, class_name);
17357
goto bad;
17358
}
17359
#ifndef Py_LIMITED_API
17360
basicsize = ((PyTypeObject *)result)->tp_basicsize;
17361
#else
17362
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
17363
if (!py_basicsize)
17364
goto bad;
17365
basicsize = PyLong_AsSsize_t(py_basicsize);
17366
Py_DECREF(py_basicsize);
17367
py_basicsize = 0;
17368
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
17369
goto bad;
17370
#endif
17371
if (!strict && (size_t)basicsize > size) {
17372
PyOS_snprintf(warning, sizeof(warning),
17373
"%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
17374
module_name, class_name, basicsize, size);
17375
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
17376
}
17377
else if ((size_t)basicsize != size) {
17378
PyErr_Format(PyExc_ValueError,
17379
"%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
17380
module_name, class_name, basicsize, size);
17381
goto bad;
17382
}
17383
return (PyTypeObject *)result;
17384
bad:
17385
Py_XDECREF(py_module);
17386
Py_XDECREF(result);
17387
return NULL;
17388
}
17389
#endif
17390
17391
/* VoidPtrImport */
17392
#ifndef __PYX_HAVE_RT_ImportVoidPtr
17393
#define __PYX_HAVE_RT_ImportVoidPtr
17394
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
17395
PyObject *d = 0;
17396
PyObject *cobj = 0;
17397
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
17398
if (!d)
17399
goto bad;
17400
cobj = PyDict_GetItemString(d, name);
17401
if (!cobj) {
17402
PyErr_Format(PyExc_ImportError,
17403
"%.200s does not export expected C variable %.200s",
17404
PyModule_GetName(module), name);
17405
goto bad;
17406
}
17407
#if PY_VERSION_HEX >= 0x02070000
17408
if (!PyCapsule_IsValid(cobj, sig)) {
17409
PyErr_Format(PyExc_TypeError,
17410
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
17411
PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
17412
goto bad;
17413
}
17414
*p = PyCapsule_GetPointer(cobj, sig);
17415
#else
17416
{const char *desc, *s1, *s2;
17417
desc = (const char *)PyCObject_GetDesc(cobj);
17418
if (!desc)
17419
goto bad;
17420
s1 = desc; s2 = sig;
17421
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
17422
if (*s1 != *s2) {
17423
PyErr_Format(PyExc_TypeError,
17424
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
17425
PyModule_GetName(module), name, sig, desc);
17426
goto bad;
17427
}
17428
*p = PyCObject_AsVoidPtr(cobj);}
17429
#endif
17430
if (!(*p))
17431
goto bad;
17432
Py_DECREF(d);
17433
return 0;
17434
bad:
17435
Py_XDECREF(d);
17436
return -1;
17437
}
17438
#endif
17439
17440
/* InitStrings */
17441
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
17442
while (t->p) {
17443
#if PY_MAJOR_VERSION < 3
17444
if (t->is_unicode) {
17445
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
17446
} else if (t->intern) {
17447
*t->p = PyString_InternFromString(t->s);
17448
} else {
17449
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
17450
}
17451
#else
17452
if (t->is_unicode | t->is_str) {
17453
if (t->intern) {
17454
*t->p = PyUnicode_InternFromString(t->s);
17455
} else if (t->encoding) {
17456
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
17457
} else {
17458
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
17459
}
17460
} else {
17461
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
17462
}
17463
#endif
17464
if (!*t->p)
17465
return -1;
17466
++t;
17467
}
17468
return 0;
17469
}
17470
17471
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
17472
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
17473
}
17474
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
17475
Py_ssize_t ignore;
17476
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
17477
}
17478
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
17479
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
17480
if (
17481
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17482
__Pyx_sys_getdefaultencoding_not_ascii &&
17483
#endif
17484
PyUnicode_Check(o)) {
17485
#if PY_VERSION_HEX < 0x03030000
17486
char* defenc_c;
17487
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
17488
if (!defenc) return NULL;
17489
defenc_c = PyBytes_AS_STRING(defenc);
17490
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17491
{
17492
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
17493
char* c;
17494
for (c = defenc_c; c < end; c++) {
17495
if ((unsigned char) (*c) >= 128) {
17496
PyUnicode_AsASCIIString(o);
17497
return NULL;
17498
}
17499
}
17500
}
17501
#endif
17502
*length = PyBytes_GET_SIZE(defenc);
17503
return defenc_c;
17504
#else
17505
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
17506
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
17507
if (PyUnicode_IS_ASCII(o)) {
17508
*length = PyUnicode_GET_LENGTH(o);
17509
return PyUnicode_AsUTF8(o);
17510
} else {
17511
PyUnicode_AsASCIIString(o);
17512
return NULL;
17513
}
17514
#else
17515
return PyUnicode_AsUTF8AndSize(o, length);
17516
#endif
17517
#endif
17518
} else
17519
#endif
17520
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
17521
if (PyByteArray_Check(o)) {
17522
*length = PyByteArray_GET_SIZE(o);
17523
return PyByteArray_AS_STRING(o);
17524
} else
17525
#endif
17526
{
17527
char* result;
17528
int r = PyBytes_AsStringAndSize(o, &result, length);
17529
if (unlikely(r < 0)) {
17530
return NULL;
17531
} else {
17532
return result;
17533
}
17534
}
17535
}
17536
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
17537
int is_true = x == Py_True;
17538
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
17539
else return PyObject_IsTrue(x);
17540
}
17541
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
17542
#if CYTHON_USE_TYPE_SLOTS
17543
PyNumberMethods *m;
17544
#endif
17545
const char *name = NULL;
17546
PyObject *res = NULL;
17547
#if PY_MAJOR_VERSION < 3
17548
if (PyInt_Check(x) || PyLong_Check(x))
17549
#else
17550
if (PyLong_Check(x))
17551
#endif
17552
return __Pyx_NewRef(x);
17553
#if CYTHON_USE_TYPE_SLOTS
17554
m = Py_TYPE(x)->tp_as_number;
17555
#if PY_MAJOR_VERSION < 3
17556
if (m && m->nb_int) {
17557
name = "int";
17558
res = PyNumber_Int(x);
17559
}
17560
else if (m && m->nb_long) {
17561
name = "long";
17562
res = PyNumber_Long(x);
17563
}
17564
#else
17565
if (m && m->nb_int) {
17566
name = "int";
17567
res = PyNumber_Long(x);
17568
}
17569
#endif
17570
#else
17571
res = PyNumber_Int(x);
17572
#endif
17573
if (res) {
17574
#if PY_MAJOR_VERSION < 3
17575
if (!PyInt_Check(res) && !PyLong_Check(res)) {
17576
#else
17577
if (!PyLong_Check(res)) {
17578
#endif
17579
PyErr_Format(PyExc_TypeError,
17580
"__%.4s__ returned non-%.4s (type %.200s)",
17581
name, name, Py_TYPE(res)->tp_name);
17582
Py_DECREF(res);
17583
return NULL;
17584
}
17585
}
17586
else if (!PyErr_Occurred()) {
17587
PyErr_SetString(PyExc_TypeError,
17588
"an integer is required");
17589
}
17590
return res;
17591
}
17592
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
17593
Py_ssize_t ival;
17594
PyObject *x;
17595
#if PY_MAJOR_VERSION < 3
17596
if (likely(PyInt_CheckExact(b))) {
17597
if (sizeof(Py_ssize_t) >= sizeof(long))
17598
return PyInt_AS_LONG(b);
17599
else
17600
return PyInt_AsSsize_t(x);
17601
}
17602
#endif
17603
if (likely(PyLong_CheckExact(b))) {
17604
#if CYTHON_USE_PYLONG_INTERNALS
17605
const digit* digits = ((PyLongObject*)b)->ob_digit;
17606
const Py_ssize_t size = Py_SIZE(b);
17607
if (likely(__Pyx_sst_abs(size) <= 1)) {
17608
ival = likely(size) ? digits[0] : 0;
17609
if (size == -1) ival = -ival;
17610
return ival;
17611
} else {
17612
switch (size) {
17613
case 2:
17614
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
17615
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17616
}
17617
break;
17618
case -2:
17619
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
17620
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17621
}
17622
break;
17623
case 3:
17624
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
17625
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17626
}
17627
break;
17628
case -3:
17629
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
17630
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
17631
}
17632
break;
17633
case 4:
17634
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
17635
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]));
17636
}
17637
break;
17638
case -4:
17639
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
17640
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]));
17641
}
17642
break;
17643
}
17644
}
17645
#endif
17646
return PyLong_AsSsize_t(b);
17647
}
17648
x = PyNumber_Index(b);
17649
if (!x) return -1;
17650
ival = PyInt_AsSsize_t(x);
17651
Py_DECREF(x);
17652
return ival;
17653
}
17654
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
17655
return PyInt_FromSize_t(ival);
17656
}
17657
17658
17659
#endif /* Py_PYTHON_H */
17660
17661