Hosted by CoCalc
Download
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__psage__modform__rational__modular_symbol_map
431
#define __PYX_HAVE_API__psage__modform__rational__modular_symbol_map
432
#include "struct_signals.h"
433
#include "pxi.h"
434
#include <string.h>
435
#include <stdlib.h>
436
#include <stdio.h>
437
#ifdef _OPENMP
438
#include <omp.h>
439
#endif /* _OPENMP */
440
441
#ifdef PYREX_WITHOUT_ASSERTIONS
442
#define CYTHON_WITHOUT_ASSERTIONS
443
#endif
444
445
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
446
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
447
448
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
449
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
450
#define __PYX_DEFAULT_STRING_ENCODING ""
451
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
452
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
453
#define __Pyx_uchar_cast(c) ((unsigned char)c)
454
#define __Pyx_long_cast(x) ((long)x)
455
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
456
(sizeof(type) < sizeof(Py_ssize_t)) ||\
457
(sizeof(type) > sizeof(Py_ssize_t) &&\
458
likely(v < (type)PY_SSIZE_T_MAX ||\
459
v == (type)PY_SSIZE_T_MAX) &&\
460
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
461
v == (type)PY_SSIZE_T_MIN))) ||\
462
(sizeof(type) == sizeof(Py_ssize_t) &&\
463
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
464
v == (type)PY_SSIZE_T_MAX))) )
465
#if defined (__cplusplus) && __cplusplus >= 201103L
466
#include <cstdlib>
467
#define __Pyx_sst_abs(value) std::abs(value)
468
#elif SIZEOF_INT >= SIZEOF_SIZE_T
469
#define __Pyx_sst_abs(value) abs(value)
470
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
471
#define __Pyx_sst_abs(value) labs(value)
472
#elif defined (_MSC_VER) && defined (_M_X64)
473
#define __Pyx_sst_abs(value) _abs64(value)
474
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
475
#define __Pyx_sst_abs(value) llabs(value)
476
#elif defined (__GNUC__)
477
#define __Pyx_sst_abs(value) __builtin_llabs(value)
478
#else
479
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
480
#endif
481
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
482
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
483
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
484
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
485
#define __Pyx_PyBytes_FromString PyBytes_FromString
486
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
487
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
488
#if PY_MAJOR_VERSION < 3
489
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
490
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
491
#else
492
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
493
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
494
#endif
495
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
496
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
497
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
498
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
499
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
500
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
501
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
502
#if PY_MAJOR_VERSION < 3
503
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
504
{
505
const Py_UNICODE *u_end = u;
506
while (*u_end++) ;
507
return (size_t)(u_end - u - 1);
508
}
509
#else
510
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
511
#endif
512
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
513
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
514
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
515
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
516
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
517
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
518
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
519
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
520
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
521
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
522
#if CYTHON_ASSUME_SAFE_MACROS
523
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
524
#else
525
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
526
#endif
527
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
528
#if PY_MAJOR_VERSION >= 3
529
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
530
#else
531
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
532
#endif
533
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
534
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
535
static int __Pyx_sys_getdefaultencoding_not_ascii;
536
static int __Pyx_init_sys_getdefaultencoding_params(void) {
537
PyObject* sys;
538
PyObject* default_encoding = NULL;
539
PyObject* ascii_chars_u = NULL;
540
PyObject* ascii_chars_b = NULL;
541
const char* default_encoding_c;
542
sys = PyImport_ImportModule("sys");
543
if (!sys) goto bad;
544
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
545
Py_DECREF(sys);
546
if (!default_encoding) goto bad;
547
default_encoding_c = PyBytes_AsString(default_encoding);
548
if (!default_encoding_c) goto bad;
549
if (strcmp(default_encoding_c, "ascii") == 0) {
550
__Pyx_sys_getdefaultencoding_not_ascii = 0;
551
} else {
552
char ascii_chars[128];
553
int c;
554
for (c = 0; c < 128; c++) {
555
ascii_chars[c] = c;
556
}
557
__Pyx_sys_getdefaultencoding_not_ascii = 1;
558
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
559
if (!ascii_chars_u) goto bad;
560
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
561
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
562
PyErr_Format(
563
PyExc_ValueError,
564
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
565
default_encoding_c);
566
goto bad;
567
}
568
Py_DECREF(ascii_chars_u);
569
Py_DECREF(ascii_chars_b);
570
}
571
Py_DECREF(default_encoding);
572
return 0;
573
bad:
574
Py_XDECREF(default_encoding);
575
Py_XDECREF(ascii_chars_u);
576
Py_XDECREF(ascii_chars_b);
577
return -1;
578
}
579
#endif
580
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
581
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
582
#else
583
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
584
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
585
static char* __PYX_DEFAULT_STRING_ENCODING;
586
static int __Pyx_init_sys_getdefaultencoding_params(void) {
587
PyObject* sys;
588
PyObject* default_encoding = NULL;
589
char* default_encoding_c;
590
sys = PyImport_ImportModule("sys");
591
if (!sys) goto bad;
592
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
593
Py_DECREF(sys);
594
if (!default_encoding) goto bad;
595
default_encoding_c = PyBytes_AsString(default_encoding);
596
if (!default_encoding_c) goto bad;
597
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
598
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
599
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
600
Py_DECREF(default_encoding);
601
return 0;
602
bad:
603
Py_XDECREF(default_encoding);
604
return -1;
605
}
606
#endif
607
#endif
608
609
610
/* Test for GCC > 2.95 */
611
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
612
#define likely(x) __builtin_expect(!!(x), 1)
613
#define unlikely(x) __builtin_expect(!!(x), 0)
614
#else /* !__GNUC__ or GCC < 2.95 */
615
#define likely(x) (x)
616
#define unlikely(x) (x)
617
#endif /* __GNUC__ */
618
619
static PyObject *__pyx_m;
620
static PyObject *__pyx_d;
621
static PyObject *__pyx_b;
622
static PyObject *__pyx_empty_tuple;
623
static PyObject *__pyx_empty_bytes;
624
static PyObject *__pyx_empty_unicode;
625
static int __pyx_lineno;
626
static int __pyx_clineno = 0;
627
static const char * __pyx_cfilenm= __FILE__;
628
static const char *__pyx_filename;
629
630
631
static const char *__pyx_f[] = {
632
"psage/modform/rational/modular_symbol_map.pyx",
633
"psage/modform/rational/modular_symbol_map.pxd",
634
"memory.pxd",
635
"stdsage.pxd",
636
"p1list.pxd",
637
"type.pxd",
638
"signals.pxi",
639
"stdsage.pxi",
640
};
641
642
/*--- Type declarations ---*/
643
struct __pyx_obj_4sage_7modular_6modsym_6p1list_export;
644
struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List;
645
struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap;
646
647
/* "psage/modform/rational/modular_symbol_map.pxd":22
648
* #################################################################################
649
*
650
* cdef enum: # <<<<<<<<<<<<<<
651
* MAX_CONTFRAC = 100
652
* MAX_DEG = 10000
653
*/
654
enum {
655
__pyx_e_5psage_7modform_8rational_18modular_symbol_map_MAX_CONTFRAC = 0x64,
656
__pyx_e_5psage_7modform_8rational_18modular_symbol_map_MAX_DEG = 0x2710
657
};
658
659
/* "sage/modular/modsym/p1list.pxd":3
660
*
661
*
662
* cdef class export: # <<<<<<<<<<<<<<
663
* cdef int c_p1_normalize_int(self, int N, int u, int v,
664
* int* uu, int* vv, int* ss,
665
*/
666
struct __pyx_obj_4sage_7modular_6modsym_6p1list_export {
667
PyObject_HEAD
668
struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_export *__pyx_vtab;
669
};
670
671
672
/* "sage/modular/modsym/p1list.pxd":13
673
*
674
*
675
* cdef class P1List: # <<<<<<<<<<<<<<
676
* cdef int __N
677
* cdef object __list, __end_hash
678
*/
679
struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List {
680
PyObject_HEAD
681
struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_P1List *__pyx_vtab;
682
int __pyx___N;
683
PyObject *__pyx___list;
684
PyObject *__pyx___end_hash;
685
int *g;
686
int *s;
687
int *t;
688
int (*__pyx___normalize)(int, int, int, int *, int *, int *, int);
689
};
690
691
692
/* "psage/modform/rational/modular_symbol_map.pxd":28
693
* from sage.modular.modsym.p1list cimport P1List
694
*
695
* cdef class ModularSymbolMap: # <<<<<<<<<<<<<<
696
* cdef long d, N
697
* cdef public long denom
698
*/
699
struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap {
700
PyObject_HEAD
701
struct __pyx_vtabstruct_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_vtab;
702
long d;
703
long N;
704
long denom;
705
long *X;
706
PyObject *C;
707
struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *P1;
708
};
709
710
711
712
/* "sage/modular/modsym/p1list.pxd":3
713
*
714
*
715
* cdef class export: # <<<<<<<<<<<<<<
716
* cdef int c_p1_normalize_int(self, int N, int u, int v,
717
* int* uu, int* vv, int* ss,
718
*/
719
720
struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_export {
721
int (*c_p1_normalize_int)(struct __pyx_obj_4sage_7modular_6modsym_6p1list_export *, int, int, int, int *, int *, int *, int);
722
int (*c_p1_normalize_llong)(struct __pyx_obj_4sage_7modular_6modsym_6p1list_export *, int, int, int, int *, int *, int *, int);
723
};
724
static struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_export *__pyx_vtabptr_4sage_7modular_6modsym_6p1list_export;
725
726
727
/* "sage/modular/modsym/p1list.pxd":13
728
*
729
*
730
* cdef class P1List: # <<<<<<<<<<<<<<
731
* cdef int __N
732
* cdef object __list, __end_hash
733
*/
734
735
struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_P1List {
736
PyObject *(*index)(struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *, int, int, int __pyx_skip_dispatch);
737
PyObject *(*index_and_scalar)(struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *, int, int, int *, int *);
738
};
739
static struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_P1List *__pyx_vtabptr_4sage_7modular_6modsym_6p1list_P1List;
740
741
742
/* "psage/modform/rational/modular_symbol_map.pyx":84
743
* return i
744
*
745
* cdef class ModularSymbolMap: # <<<<<<<<<<<<<<
746
* def __cinit__(self):
747
* self.X = NULL
748
*/
749
750
struct __pyx_vtabstruct_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap {
751
int (*evaluate)(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *, long *, long, long);
752
};
753
static struct __pyx_vtabstruct_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_vtabptr_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap;
754
755
/* --- Runtime support code (head) --- */
756
/* Refnanny.proto */
757
#ifndef CYTHON_REFNANNY
758
#define CYTHON_REFNANNY 0
759
#endif
760
#if CYTHON_REFNANNY
761
typedef struct {
762
void (*INCREF)(void*, PyObject*, int);
763
void (*DECREF)(void*, PyObject*, int);
764
void (*GOTREF)(void*, PyObject*, int);
765
void (*GIVEREF)(void*, PyObject*, int);
766
void* (*SetupContext)(const char*, int, const char*);
767
void (*FinishContext)(void**);
768
} __Pyx_RefNannyAPIStruct;
769
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
770
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
771
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
772
#ifdef WITH_THREAD
773
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
774
if (acquire_gil) {\
775
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
776
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
777
PyGILState_Release(__pyx_gilstate_save);\
778
} else {\
779
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
780
}
781
#else
782
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
783
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
784
#endif
785
#define __Pyx_RefNannyFinishContext()\
786
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
787
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
788
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
789
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
790
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
791
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
792
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
793
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
794
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
795
#else
796
#define __Pyx_RefNannyDeclarations
797
#define __Pyx_RefNannySetupContext(name, acquire_gil)
798
#define __Pyx_RefNannyFinishContext()
799
#define __Pyx_INCREF(r) Py_INCREF(r)
800
#define __Pyx_DECREF(r) Py_DECREF(r)
801
#define __Pyx_GOTREF(r)
802
#define __Pyx_GIVEREF(r)
803
#define __Pyx_XINCREF(r) Py_XINCREF(r)
804
#define __Pyx_XDECREF(r) Py_XDECREF(r)
805
#define __Pyx_XGOTREF(r)
806
#define __Pyx_XGIVEREF(r)
807
#endif
808
#define __Pyx_XDECREF_SET(r, v) do {\
809
PyObject *tmp = (PyObject *) r;\
810
r = v; __Pyx_XDECREF(tmp);\
811
} while (0)
812
#define __Pyx_DECREF_SET(r, v) do {\
813
PyObject *tmp = (PyObject *) r;\
814
r = v; __Pyx_DECREF(tmp);\
815
} while (0)
816
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
817
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
818
819
/* PyObjectGetAttrStr.proto */
820
#if CYTHON_USE_TYPE_SLOTS
821
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
822
PyTypeObject* tp = Py_TYPE(obj);
823
if (likely(tp->tp_getattro))
824
return tp->tp_getattro(obj, attr_name);
825
#if PY_MAJOR_VERSION < 3
826
if (likely(tp->tp_getattr))
827
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
828
#endif
829
return PyObject_GetAttr(obj, attr_name);
830
}
831
#else
832
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
833
#endif
834
835
/* GetBuiltinName.proto */
836
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
837
838
/* RaiseArgTupleInvalid.proto */
839
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
840
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
841
842
/* RaiseDoubleKeywords.proto */
843
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
844
845
/* ParseKeywords.proto */
846
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
847
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
848
const char* function_name);
849
850
/* ListCompAppend.proto */
851
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
852
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
853
PyListObject* L = (PyListObject*) list;
854
Py_ssize_t len = Py_SIZE(list);
855
if (likely(L->allocated > len)) {
856
Py_INCREF(x);
857
PyList_SET_ITEM(list, len, x);
858
Py_SIZE(list) = len+1;
859
return 0;
860
}
861
return PyList_Append(list, x);
862
}
863
#else
864
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
865
#endif
866
867
/* PyThreadStateGet.proto */
868
#if CYTHON_FAST_THREAD_STATE
869
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
870
#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
871
#else
872
#define __Pyx_PyThreadState_declare
873
#define __Pyx_PyThreadState_assign
874
#endif
875
876
/* PyErrFetchRestore.proto */
877
#if CYTHON_FAST_THREAD_STATE
878
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
879
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
880
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
881
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
882
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
883
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
884
#else
885
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
886
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
887
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
888
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
889
#endif
890
891
/* RaiseException.proto */
892
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
893
894
/* None.proto */
895
static CYTHON_INLINE long __Pyx_mod_long(long, long);
896
897
/* None.proto */
898
static CYTHON_INLINE long __Pyx_div_long(long, long);
899
900
/* UnaryNegOverflows.proto */
901
#define UNARY_NEG_WOULD_OVERFLOW(x)\
902
(((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
903
904
/* KeywordStringCheck.proto */
905
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
906
907
/* Import.proto */
908
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
909
910
/* ImportFrom.proto */
911
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
912
913
/* PyCFunctionFastCall.proto */
914
#if CYTHON_FAST_PYCCALL
915
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
916
#else
917
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
918
#endif
919
920
/* PyFunctionFastCall.proto */
921
#if CYTHON_FAST_PYCALL
922
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
923
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
924
#if 1 || PY_VERSION_HEX < 0x030600B1
925
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
926
#else
927
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
928
#endif
929
#endif
930
931
/* PyObjectCall.proto */
932
#if CYTHON_COMPILING_IN_CPYTHON
933
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
934
#else
935
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
936
#endif
937
938
/* PyObjectCallMethO.proto */
939
#if CYTHON_COMPILING_IN_CPYTHON
940
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
941
#endif
942
943
/* PyObjectCallOneArg.proto */
944
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
945
946
/* PyObjectCallNoArg.proto */
947
#if CYTHON_COMPILING_IN_CPYTHON
948
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
949
#else
950
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
951
#endif
952
953
/* RaiseTooManyValuesToUnpack.proto */
954
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
955
956
/* RaiseNeedMoreValuesToUnpack.proto */
957
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
958
959
/* IterFinish.proto */
960
static CYTHON_INLINE int __Pyx_IterFinish(void);
961
962
/* UnpackItemEndCheck.proto */
963
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
964
965
/* GetModuleGlobalName.proto */
966
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
967
968
/* PyIntBinop.proto */
969
#if !CYTHON_COMPILING_IN_PYPY
970
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
971
#else
972
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
973
PyObject_RichCompare(op1, op2, Py_EQ)
974
#endif
975
976
/* SetVTable.proto */
977
static int __Pyx_SetVtable(PyObject *dict, void *vtable);
978
979
/* GetVTable.proto */
980
static void* __Pyx_GetVtable(PyObject *dict);
981
982
/* CodeObjectCache.proto */
983
typedef struct {
984
PyCodeObject* code_object;
985
int code_line;
986
} __Pyx_CodeObjectCacheEntry;
987
struct __Pyx_CodeObjectCache {
988
int count;
989
int max_count;
990
__Pyx_CodeObjectCacheEntry* entries;
991
};
992
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
993
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
994
static PyCodeObject *__pyx_find_code_object(int code_line);
995
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
996
997
/* AddTraceback.proto */
998
static void __Pyx_AddTraceback(const char *funcname, int c_line,
999
int py_line, const char *filename);
1000
1001
/* CIntToPy.proto */
1002
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1003
1004
/* CIntToPy.proto */
1005
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1006
1007
/* CIntFromPy.proto */
1008
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1009
1010
/* CIntFromPy.proto */
1011
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1012
1013
/* CIntFromPy.proto */
1014
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
1015
1016
/* CheckBinaryVersion.proto */
1017
static int __Pyx_check_binary_version(void);
1018
1019
/* PyIdentifierFromString.proto */
1020
#if !defined(__Pyx_PyIdentifier_FromString)
1021
#if PY_MAJOR_VERSION < 3
1022
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1023
#else
1024
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1025
#endif
1026
#endif
1027
1028
/* ModuleImport.proto */
1029
static PyObject *__Pyx_ImportModule(const char *name);
1030
1031
/* TypeImport.proto */
1032
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1033
1034
/* VoidPtrImport.proto */
1035
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
1036
1037
/* InitStrings.proto */
1038
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1039
1040
static int __pyx_f_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_evaluate(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, long *__pyx_v_v, long __pyx_v_a, long __pyx_v_b); /* proto*/
1041
1042
/* Module declarations from 'sage.modular.modsym.p1list' */
1043
static PyTypeObject *__pyx_ptype_4sage_7modular_6modsym_6p1list_export = 0;
1044
static PyTypeObject *__pyx_ptype_4sage_7modular_6modsym_6p1list_P1List = 0;
1045
1046
/* Module declarations from 'cysignals.__init__' */
1047
1048
/* Module declarations from 'cysignals' */
1049
1050
/* Module declarations from 'cysignals.signals' */
1051
static cysigs_t *__pyx_vp_9cysignals_7signals_cysigs = 0;
1052
#define cysigs (*__pyx_vp_9cysignals_7signals_cysigs)
1053
static void (*__pyx_f_9cysignals_7signals_print_backtrace)(void); /*proto*/
1054
static void (*__pyx_f_9cysignals_7signals__sig_on_interrupt_received)(void); /*proto*/
1055
static void (*__pyx_f_9cysignals_7signals__sig_on_recover)(void); /*proto*/
1056
static void (*__pyx_f_9cysignals_7signals__sig_off_warning)(char const *, int); /*proto*/
1057
1058
/* Module declarations from 'cython' */
1059
1060
/* Module declarations from 'libc.string' */
1061
1062
/* Module declarations from 'libc.stdlib' */
1063
1064
/* Module declarations from 'cysignals.memory' */
1065
static CYTHON_INLINE void *sig_malloc(size_t); /*proto*/
1066
static CYTHON_INLINE void *sig_realloc(void *, size_t); /*proto*/
1067
static CYTHON_INLINE void *sig_calloc(size_t, size_t); /*proto*/
1068
static CYTHON_INLINE void sig_free(void *); /*proto*/
1069
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t, size_t); /*proto*/
1070
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t, size_t); /*proto*/
1071
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *, size_t, size_t); /*proto*/
1072
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t); /*proto*/
1073
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *, size_t); /*proto*/
1074
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t, size_t); /*proto*/
1075
1076
/* Module declarations from 'libc.stdio' */
1077
1078
/* Module declarations from '__builtin__' */
1079
1080
/* Module declarations from 'cpython.type' */
1081
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1082
1083
/* Module declarations from 'cpython' */
1084
1085
/* Module declarations from 'cpython.object' */
1086
1087
/* Module declarations from 'sage.ext.stdsage' */
1088
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *); /*proto*/
1089
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *); /*proto*/
1090
1091
/* Module declarations from 'psage.modform.rational.modular_symbol_map' */
1092
static PyTypeObject *__pyx_ptype_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap = 0;
1093
static long __pyx_f_5psage_7modform_8rational_18modular_symbol_map_contfrac_q(long *, long, long); /*proto*/
1094
#define __Pyx_MODULE_NAME "psage.modform.rational.modular_symbol_map"
1095
int __pyx_module_is_main_psage__modform__rational__modular_symbol_map = 0;
1096
1097
/* Implementation of 'psage.modform.rational.modular_symbol_map' */
1098
static PyObject *__pyx_builtin_range;
1099
static PyObject *__pyx_builtin_ZeroDivisionError;
1100
static PyObject *__pyx_builtin_NotImplementedError;
1101
static PyObject *__pyx_builtin_ValueError;
1102
static PyObject *__pyx_builtin_MemoryError;
1103
static const char __pyx_k_[] = "*";
1104
static const char __pyx_k_A[] = "A";
1105
static const char __pyx_k_a[] = "a";
1106
static const char __pyx_k_b[] = "b";
1107
static const char __pyx_k_i[] = "i";
1108
static const char __pyx_k_n[] = "n";
1109
static const char __pyx_k_QQ[] = "QQ";
1110
static const char __pyx_k_ZZ[] = "ZZ";
1111
static const char __pyx_k_qi[] = "qi";
1112
static const char __pyx_k_list[] = "list";
1113
static const char __pyx_k_main[] = "__main__";
1114
static const char __pyx_k_sign[] = "sign";
1115
static const char __pyx_k_test[] = "__test__";
1116
static const char __pyx_k_level[] = "level";
1117
static const char __pyx_k_ncols[] = "ncols";
1118
static const char __pyx_k_nrows[] = "nrows";
1119
static const char __pyx_k_range[] = "range";
1120
static const char __pyx_k_import[] = "__import__";
1121
static const char __pyx_k_matrix[] = "matrix";
1122
static const char __pyx_k_Integer[] = "Integer";
1123
static const char __pyx_k_element[] = "element";
1124
static const char __pyx_k_conductor[] = "conductor";
1125
static const char __pyx_k_dimension[] = "dimension";
1126
static const char __pyx_k_transpose[] = "transpose";
1127
static const char __pyx_k_ValueError[] = "ValueError";
1128
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1129
static const char __pyx_k_MemoryError[] = "MemoryError";
1130
static const char __pyx_k_clear_denom[] = "_clear_denom";
1131
static const char __pyx_k_basis_matrix[] = "basis_matrix";
1132
static const char __pyx_k_lift_to_sl2z[] = "lift_to_sl2z";
1133
static const char __pyx_k_manin_symbol[] = "manin_symbol";
1134
static const char __pyx_k_ModularSymbol[] = "ModularSymbol";
1135
static const char __pyx_k_ambient_module[] = "ambient_module";
1136
static const char __pyx_k_elliptic_curve[] = "elliptic_curve";
1137
static const char __pyx_k_sage_rings_all[] = "sage.rings.all";
1138
static const char __pyx_k_sage_ext_memory[] = "sage.ext.memory";
1139
static const char __pyx_k_sage_matrix_all[] = "sage.matrix.all";
1140
static const char __pyx_k_test_contfrac_q[] = "test_contfrac_q";
1141
static const char __pyx_k_dual_free_module[] = "dual_free_module";
1142
static const char __pyx_k_ZeroDivisionError[] = "ZeroDivisionError";
1143
static const char __pyx_k_ModularSymbolsSpace[] = "ModularSymbolsSpace";
1144
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
1145
static const char __pyx_k_init_memory_functions[] = "init_memory_functions";
1146
static const char __pyx_k_A_must_have_sign_1_or_1[] = "A must have sign +1 or -1";
1147
static const char __pyx_k_init_using_modsym_space[] = "_init_using_modsym_space";
1148
static const char __pyx_k_sage_modular_modsym_space[] = "sage.modular.modsym.space";
1149
static const char __pyx_k_failed_to_allocate_s_bytes[] = "failed to allocate %s bytes";
1150
static const char __pyx_k_failed_to_allocate_s_s_bytes[] = "failed to allocate %s * %s bytes";
1151
static const char __pyx_k_init_using_ell_modular_symbol[] = "_init_using_ell_modular_symbol";
1152
static const char __pyx_k_Modular_symbols_map_for_modular[] = "Modular symbols map for modular symbols factor of dimension %s and level %s";
1153
static const char __pyx_k_projects_68c8b2b8_03ba_44d4_a0d[] = "/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/psage/modform/rational/modular_symbol_map.pyx";
1154
static const char __pyx_k_Creating_modular_symbols_from_ob[] = "Creating modular symbols from object of type %s not implemented";
1155
static const char __pyx_k_File_modular_symbol_map_pyx_star[] = "File: modular_symbol_map.pyx (starting at line 1)\n\nHighly optimized computation of the modular symbols map associated to\na simple new space of modular symbols.\n\nAUTHOR:\n - William Stein\n";
1156
static const char __pyx_k_psage_modform_rational_modular_s[] = "psage.modform.rational.modular_symbol_map";
1157
static const char __pyx_k_sage_schemes_elliptic_curves_ell[] = "sage.schemes.elliptic_curves.ell_modular_symbols";
1158
static PyObject *__pyx_n_s_;
1159
static PyObject *__pyx_n_s_A;
1160
static PyObject *__pyx_kp_s_A_must_have_sign_1_or_1;
1161
static PyObject *__pyx_kp_s_Creating_modular_symbols_from_ob;
1162
static PyObject *__pyx_n_s_Integer;
1163
static PyObject *__pyx_n_s_MemoryError;
1164
static PyObject *__pyx_n_s_ModularSymbol;
1165
static PyObject *__pyx_n_s_ModularSymbolsSpace;
1166
static PyObject *__pyx_kp_s_Modular_symbols_map_for_modular;
1167
static PyObject *__pyx_n_s_NotImplementedError;
1168
static PyObject *__pyx_n_s_QQ;
1169
static PyObject *__pyx_n_s_ValueError;
1170
static PyObject *__pyx_n_s_ZZ;
1171
static PyObject *__pyx_n_s_ZeroDivisionError;
1172
static PyObject *__pyx_n_s_a;
1173
static PyObject *__pyx_n_s_ambient_module;
1174
static PyObject *__pyx_n_s_b;
1175
static PyObject *__pyx_n_s_basis_matrix;
1176
static PyObject *__pyx_n_s_clear_denom;
1177
static PyObject *__pyx_n_s_conductor;
1178
static PyObject *__pyx_n_s_dimension;
1179
static PyObject *__pyx_n_s_dual_free_module;
1180
static PyObject *__pyx_n_s_element;
1181
static PyObject *__pyx_n_s_elliptic_curve;
1182
static PyObject *__pyx_kp_s_failed_to_allocate_s_bytes;
1183
static PyObject *__pyx_kp_s_failed_to_allocate_s_s_bytes;
1184
static PyObject *__pyx_n_s_i;
1185
static PyObject *__pyx_n_s_import;
1186
static PyObject *__pyx_n_s_init_memory_functions;
1187
static PyObject *__pyx_n_s_init_using_ell_modular_symbol;
1188
static PyObject *__pyx_n_s_init_using_modsym_space;
1189
static PyObject *__pyx_n_s_level;
1190
static PyObject *__pyx_n_s_lift_to_sl2z;
1191
static PyObject *__pyx_n_s_list;
1192
static PyObject *__pyx_n_s_main;
1193
static PyObject *__pyx_n_s_manin_symbol;
1194
static PyObject *__pyx_n_s_matrix;
1195
static PyObject *__pyx_n_s_n;
1196
static PyObject *__pyx_n_s_ncols;
1197
static PyObject *__pyx_n_s_nrows;
1198
static PyObject *__pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d;
1199
static PyObject *__pyx_n_s_psage_modform_rational_modular_s;
1200
static PyObject *__pyx_n_s_pyx_vtable;
1201
static PyObject *__pyx_n_s_qi;
1202
static PyObject *__pyx_n_s_range;
1203
static PyObject *__pyx_n_s_sage_ext_memory;
1204
static PyObject *__pyx_n_s_sage_matrix_all;
1205
static PyObject *__pyx_n_s_sage_modular_modsym_space;
1206
static PyObject *__pyx_n_s_sage_rings_all;
1207
static PyObject *__pyx_n_s_sage_schemes_elliptic_curves_ell;
1208
static PyObject *__pyx_n_s_sign;
1209
static PyObject *__pyx_n_s_test;
1210
static PyObject *__pyx_n_s_test_contfrac_q;
1211
static PyObject *__pyx_n_s_transpose;
1212
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_test_contfrac_q(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
1213
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap___cinit__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1214
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1215
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_A); /* proto */
1216
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_6_init_using_ell_modular_symbol(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
1217
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_8_init_using_modsym_space(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_A); /* proto */
1218
static void __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_10__dealloc__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1219
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_12dimension(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1220
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_14_eval0(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
1221
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_16_eval1(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
1222
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom___get__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1223
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_2__set__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1224
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C___get__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1225
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_2__set__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1226
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_4__del__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self); /* proto */
1227
static PyObject *__pyx_tp_new_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1228
static PyObject *__pyx_int_0;
1229
static PyObject *__pyx_int_1;
1230
static PyObject *__pyx_tuple__2;
1231
static PyObject *__pyx_codeobj__3;
1232
1233
/* "psage/modform/rational/modular_symbol_map.pyx":36
1234
* include 'stdsage.pxi'
1235
*
1236
* def test_contfrac_q(a, b): # <<<<<<<<<<<<<<
1237
* """
1238
* EXAMPLES::
1239
*/
1240
1241
/* Python wrapper */
1242
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_1test_contfrac_q(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1243
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_test_contfrac_q[] = "File: modular_symbol_map.pyx (starting at line 36)\n\n EXAMPLES::\n \n sage: import psage.modform.rational.modular_symbol_map\n sage: psage.modform.rational.modular_symbol_map.test_contfrac_q(7, 97)\n [1, 13, 14, 97]\n sage: continued_fraction(7/97).convergents()\n [0, 1/13, 1/14, 7/97]\n sage: psage.modform.rational.modular_symbol_map.test_contfrac_q(137, 93997)\n [1, 686, 6175, 43911, 93997]\n sage: continued_fraction(137/93997).convergents()\n [0, 1/686, 9/6175, 64/43911, 137/93997]\n ";
1244
static PyMethodDef __pyx_mdef_5psage_7modform_8rational_18modular_symbol_map_1test_contfrac_q = {"test_contfrac_q", (PyCFunction)__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_1test_contfrac_q, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_test_contfrac_q};
1245
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_1test_contfrac_q(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1246
PyObject *__pyx_v_a = 0;
1247
PyObject *__pyx_v_b = 0;
1248
PyObject *__pyx_r = 0;
1249
__Pyx_RefNannyDeclarations
1250
__Pyx_RefNannySetupContext("test_contfrac_q (wrapper)", 0);
1251
{
1252
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
1253
PyObject* values[2] = {0,0};
1254
if (unlikely(__pyx_kwds)) {
1255
Py_ssize_t kw_args;
1256
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1257
switch (pos_args) {
1258
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1259
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1260
case 0: break;
1261
default: goto __pyx_L5_argtuple_error;
1262
}
1263
kw_args = PyDict_Size(__pyx_kwds);
1264
switch (pos_args) {
1265
case 0:
1266
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
1267
else goto __pyx_L5_argtuple_error;
1268
case 1:
1269
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
1270
else {
1271
__Pyx_RaiseArgtupleInvalid("test_contfrac_q", 1, 2, 2, 1); __PYX_ERR(0, 36, __pyx_L3_error)
1272
}
1273
}
1274
if (unlikely(kw_args > 0)) {
1275
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "test_contfrac_q") < 0)) __PYX_ERR(0, 36, __pyx_L3_error)
1276
}
1277
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
1278
goto __pyx_L5_argtuple_error;
1279
} else {
1280
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1281
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1282
}
1283
__pyx_v_a = values[0];
1284
__pyx_v_b = values[1];
1285
}
1286
goto __pyx_L4_argument_unpacking_done;
1287
__pyx_L5_argtuple_error:;
1288
__Pyx_RaiseArgtupleInvalid("test_contfrac_q", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 36, __pyx_L3_error)
1289
__pyx_L3_error:;
1290
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.test_contfrac_q", __pyx_clineno, __pyx_lineno, __pyx_filename);
1291
__Pyx_RefNannyFinishContext();
1292
return NULL;
1293
__pyx_L4_argument_unpacking_done:;
1294
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_test_contfrac_q(__pyx_self, __pyx_v_a, __pyx_v_b);
1295
1296
/* function exit code */
1297
__Pyx_RefNannyFinishContext();
1298
return __pyx_r;
1299
}
1300
1301
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_test_contfrac_q(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
1302
long __pyx_v_qi[__pyx_e_5psage_7modform_8rational_18modular_symbol_map_MAX_CONTFRAC];
1303
int __pyx_v_n;
1304
int __pyx_v_i;
1305
PyObject *__pyx_r = NULL;
1306
__Pyx_RefNannyDeclarations
1307
long __pyx_t_1;
1308
long __pyx_t_2;
1309
long __pyx_t_3;
1310
PyObject *__pyx_t_4 = NULL;
1311
int __pyx_t_5;
1312
int __pyx_t_6;
1313
PyObject *__pyx_t_7 = NULL;
1314
__Pyx_RefNannySetupContext("test_contfrac_q", 0);
1315
1316
/* "psage/modform/rational/modular_symbol_map.pyx":51
1317
* """
1318
* cdef long qi[MAX_CONTFRAC]
1319
* cdef int n = contfrac_q(qi, a, b) # <<<<<<<<<<<<<<
1320
* return [qi[i] for i in range(n)]
1321
*
1322
*/
1323
__pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_a); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error)
1324
__pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_b); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L1_error)
1325
__pyx_t_3 = __pyx_f_5psage_7modform_8rational_18modular_symbol_map_contfrac_q(__pyx_v_qi, __pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1L)) __PYX_ERR(0, 51, __pyx_L1_error)
1326
__pyx_v_n = __pyx_t_3;
1327
1328
/* "psage/modform/rational/modular_symbol_map.pyx":52
1329
* cdef long qi[MAX_CONTFRAC]
1330
* cdef int n = contfrac_q(qi, a, b)
1331
* return [qi[i] for i in range(n)] # <<<<<<<<<<<<<<
1332
*
1333
* cdef long contfrac_q(long qi[MAX_CONTFRAC], long a, long b) except -1:
1334
*/
1335
__Pyx_XDECREF(__pyx_r);
1336
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
1337
__Pyx_GOTREF(__pyx_t_4);
1338
__pyx_t_5 = __pyx_v_n;
1339
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
1340
__pyx_v_i = __pyx_t_6;
1341
__pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_qi[__pyx_v_i])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error)
1342
__Pyx_GOTREF(__pyx_t_7);
1343
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 52, __pyx_L1_error)
1344
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1345
}
1346
__pyx_r = __pyx_t_4;
1347
__pyx_t_4 = 0;
1348
goto __pyx_L0;
1349
1350
/* "psage/modform/rational/modular_symbol_map.pyx":36
1351
* include 'stdsage.pxi'
1352
*
1353
* def test_contfrac_q(a, b): # <<<<<<<<<<<<<<
1354
* """
1355
* EXAMPLES::
1356
*/
1357
1358
/* function exit code */
1359
__pyx_L1_error:;
1360
__Pyx_XDECREF(__pyx_t_4);
1361
__Pyx_XDECREF(__pyx_t_7);
1362
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.test_contfrac_q", __pyx_clineno, __pyx_lineno, __pyx_filename);
1363
__pyx_r = NULL;
1364
__pyx_L0:;
1365
__Pyx_XGIVEREF(__pyx_r);
1366
__Pyx_RefNannyFinishContext();
1367
return __pyx_r;
1368
}
1369
1370
/* "psage/modform/rational/modular_symbol_map.pyx":54
1371
* return [qi[i] for i in range(n)]
1372
*
1373
* cdef long contfrac_q(long qi[MAX_CONTFRAC], long a, long b) except -1: # <<<<<<<<<<<<<<
1374
* """
1375
* Given coprime integers `a`, `b`, compute the sequence `q_i` of
1376
*/
1377
1378
static long __pyx_f_5psage_7modform_8rational_18modular_symbol_map_contfrac_q(long *__pyx_v_qi, long __pyx_v_a, long __pyx_v_b) {
1379
int __pyx_v_i;
1380
long __pyx_r;
1381
__Pyx_RefNannyDeclarations
1382
int __pyx_t_1;
1383
long __pyx_t_2;
1384
long __pyx_t_3;
1385
__Pyx_RefNannySetupContext("contfrac_q", 0);
1386
1387
/* "psage/modform/rational/modular_symbol_map.pyx":65
1388
* cdef long c
1389
*
1390
* qi[0] = 1 # <<<<<<<<<<<<<<
1391
* if a == 0:
1392
* return 1
1393
*/
1394
(__pyx_v_qi[0]) = 1;
1395
1396
/* "psage/modform/rational/modular_symbol_map.pyx":66
1397
*
1398
* qi[0] = 1
1399
* if a == 0: # <<<<<<<<<<<<<<
1400
* return 1
1401
* if b == 0:
1402
*/
1403
__pyx_t_1 = ((__pyx_v_a == 0) != 0);
1404
if (__pyx_t_1) {
1405
1406
/* "psage/modform/rational/modular_symbol_map.pyx":67
1407
* qi[0] = 1
1408
* if a == 0:
1409
* return 1 # <<<<<<<<<<<<<<
1410
* if b == 0:
1411
* raise ZeroDivisionError
1412
*/
1413
__pyx_r = 1;
1414
goto __pyx_L0;
1415
1416
/* "psage/modform/rational/modular_symbol_map.pyx":66
1417
*
1418
* qi[0] = 1
1419
* if a == 0: # <<<<<<<<<<<<<<
1420
* return 1
1421
* if b == 0:
1422
*/
1423
}
1424
1425
/* "psage/modform/rational/modular_symbol_map.pyx":68
1426
* if a == 0:
1427
* return 1
1428
* if b == 0: # <<<<<<<<<<<<<<
1429
* raise ZeroDivisionError
1430
*
1431
*/
1432
__pyx_t_1 = ((__pyx_v_b == 0) != 0);
1433
if (__pyx_t_1) {
1434
1435
/* "psage/modform/rational/modular_symbol_map.pyx":69
1436
* return 1
1437
* if b == 0:
1438
* raise ZeroDivisionError # <<<<<<<<<<<<<<
1439
*
1440
* # one iteration isn't needed, since we are only computing the q_i.
1441
*/
1442
__Pyx_Raise(__pyx_builtin_ZeroDivisionError, 0, 0, 0);
1443
__PYX_ERR(0, 69, __pyx_L1_error)
1444
1445
/* "psage/modform/rational/modular_symbol_map.pyx":68
1446
* if a == 0:
1447
* return 1
1448
* if b == 0: # <<<<<<<<<<<<<<
1449
* raise ZeroDivisionError
1450
*
1451
*/
1452
}
1453
1454
/* "psage/modform/rational/modular_symbol_map.pyx":72
1455
*
1456
* # one iteration isn't needed, since we are only computing the q_i.
1457
* a,b = b, a%b # <<<<<<<<<<<<<<
1458
* cdef int i=1
1459
* while b:
1460
*/
1461
__pyx_t_2 = __pyx_v_b;
1462
if (unlikely(__pyx_v_b == 0)) {
1463
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
1464
__PYX_ERR(0, 72, __pyx_L1_error)
1465
}
1466
__pyx_t_3 = __Pyx_mod_long(__pyx_v_a, __pyx_v_b);
1467
__pyx_v_a = __pyx_t_2;
1468
__pyx_v_b = __pyx_t_3;
1469
1470
/* "psage/modform/rational/modular_symbol_map.pyx":73
1471
* # one iteration isn't needed, since we are only computing the q_i.
1472
* a,b = b, a%b
1473
* cdef int i=1 # <<<<<<<<<<<<<<
1474
* while b:
1475
* if i >= 2:
1476
*/
1477
__pyx_v_i = 1;
1478
1479
/* "psage/modform/rational/modular_symbol_map.pyx":74
1480
* a,b = b, a%b
1481
* cdef int i=1
1482
* while b: # <<<<<<<<<<<<<<
1483
* if i >= 2:
1484
* qi[i] = qi[i-1]*(a//b) + qi[i-2]
1485
*/
1486
while (1) {
1487
__pyx_t_1 = (__pyx_v_b != 0);
1488
if (!__pyx_t_1) break;
1489
1490
/* "psage/modform/rational/modular_symbol_map.pyx":75
1491
* cdef int i=1
1492
* while b:
1493
* if i >= 2: # <<<<<<<<<<<<<<
1494
* qi[i] = qi[i-1]*(a//b) + qi[i-2]
1495
* else:
1496
*/
1497
__pyx_t_1 = ((__pyx_v_i >= 2) != 0);
1498
if (__pyx_t_1) {
1499
1500
/* "psage/modform/rational/modular_symbol_map.pyx":76
1501
* while b:
1502
* if i >= 2:
1503
* qi[i] = qi[i-1]*(a//b) + qi[i-2] # <<<<<<<<<<<<<<
1504
* else:
1505
* qi[1] = a//b
1506
*/
1507
if (unlikely(__pyx_v_b == 0)) {
1508
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
1509
__PYX_ERR(0, 76, __pyx_L1_error)
1510
}
1511
else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_b == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_a))) {
1512
PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
1513
__PYX_ERR(0, 76, __pyx_L1_error)
1514
}
1515
(__pyx_v_qi[__pyx_v_i]) = (((__pyx_v_qi[(__pyx_v_i - 1)]) * __Pyx_div_long(__pyx_v_a, __pyx_v_b)) + (__pyx_v_qi[(__pyx_v_i - 2)]));
1516
1517
/* "psage/modform/rational/modular_symbol_map.pyx":75
1518
* cdef int i=1
1519
* while b:
1520
* if i >= 2: # <<<<<<<<<<<<<<
1521
* qi[i] = qi[i-1]*(a//b) + qi[i-2]
1522
* else:
1523
*/
1524
goto __pyx_L7;
1525
}
1526
1527
/* "psage/modform/rational/modular_symbol_map.pyx":78
1528
* qi[i] = qi[i-1]*(a//b) + qi[i-2]
1529
* else:
1530
* qi[1] = a//b # <<<<<<<<<<<<<<
1531
* a,b = b, a%b
1532
* i += 1
1533
*/
1534
/*else*/ {
1535
if (unlikely(__pyx_v_b == 0)) {
1536
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
1537
__PYX_ERR(0, 78, __pyx_L1_error)
1538
}
1539
else if (sizeof(long) == sizeof(long) && (!(((long)-1) > 0)) && unlikely(__pyx_v_b == (long)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_a))) {
1540
PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
1541
__PYX_ERR(0, 78, __pyx_L1_error)
1542
}
1543
(__pyx_v_qi[1]) = __Pyx_div_long(__pyx_v_a, __pyx_v_b);
1544
}
1545
__pyx_L7:;
1546
1547
/* "psage/modform/rational/modular_symbol_map.pyx":79
1548
* else:
1549
* qi[1] = a//b
1550
* a,b = b, a%b # <<<<<<<<<<<<<<
1551
* i += 1
1552
*
1553
*/
1554
__pyx_t_3 = __pyx_v_b;
1555
if (unlikely(__pyx_v_b == 0)) {
1556
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
1557
__PYX_ERR(0, 79, __pyx_L1_error)
1558
}
1559
__pyx_t_2 = __Pyx_mod_long(__pyx_v_a, __pyx_v_b);
1560
__pyx_v_a = __pyx_t_3;
1561
__pyx_v_b = __pyx_t_2;
1562
1563
/* "psage/modform/rational/modular_symbol_map.pyx":80
1564
* qi[1] = a//b
1565
* a,b = b, a%b
1566
* i += 1 # <<<<<<<<<<<<<<
1567
*
1568
* return i
1569
*/
1570
__pyx_v_i = (__pyx_v_i + 1);
1571
}
1572
1573
/* "psage/modform/rational/modular_symbol_map.pyx":82
1574
* i += 1
1575
*
1576
* return i # <<<<<<<<<<<<<<
1577
*
1578
* cdef class ModularSymbolMap:
1579
*/
1580
__pyx_r = __pyx_v_i;
1581
goto __pyx_L0;
1582
1583
/* "psage/modform/rational/modular_symbol_map.pyx":54
1584
* return [qi[i] for i in range(n)]
1585
*
1586
* cdef long contfrac_q(long qi[MAX_CONTFRAC], long a, long b) except -1: # <<<<<<<<<<<<<<
1587
* """
1588
* Given coprime integers `a`, `b`, compute the sequence `q_i` of
1589
*/
1590
1591
/* function exit code */
1592
__pyx_L1_error:;
1593
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.contfrac_q", __pyx_clineno, __pyx_lineno, __pyx_filename);
1594
__pyx_r = -1L;
1595
__pyx_L0:;
1596
__Pyx_RefNannyFinishContext();
1597
return __pyx_r;
1598
}
1599
1600
/* "psage/modform/rational/modular_symbol_map.pyx":85
1601
*
1602
* cdef class ModularSymbolMap:
1603
* def __cinit__(self): # <<<<<<<<<<<<<<
1604
* self.X = NULL
1605
*
1606
*/
1607
1608
/* Python wrapper */
1609
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1610
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1611
int __pyx_r;
1612
__Pyx_RefNannyDeclarations
1613
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1614
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
1615
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
1616
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
1617
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap___cinit__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
1618
1619
/* function exit code */
1620
__Pyx_RefNannyFinishContext();
1621
return __pyx_r;
1622
}
1623
1624
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap___cinit__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
1625
int __pyx_r;
1626
__Pyx_RefNannyDeclarations
1627
__Pyx_RefNannySetupContext("__cinit__", 0);
1628
1629
/* "psage/modform/rational/modular_symbol_map.pyx":86
1630
* cdef class ModularSymbolMap:
1631
* def __cinit__(self):
1632
* self.X = NULL # <<<<<<<<<<<<<<
1633
*
1634
* def __repr__(self):
1635
*/
1636
__pyx_v_self->X = NULL;
1637
1638
/* "psage/modform/rational/modular_symbol_map.pyx":85
1639
*
1640
* cdef class ModularSymbolMap:
1641
* def __cinit__(self): # <<<<<<<<<<<<<<
1642
* self.X = NULL
1643
*
1644
*/
1645
1646
/* function exit code */
1647
__pyx_r = 0;
1648
__Pyx_RefNannyFinishContext();
1649
return __pyx_r;
1650
}
1651
1652
/* "psage/modform/rational/modular_symbol_map.pyx":88
1653
* self.X = NULL
1654
*
1655
* def __repr__(self): # <<<<<<<<<<<<<<
1656
* return "Modular symbols map for modular symbols factor of dimension %s and level %s"%(self.d, self.N)
1657
*
1658
*/
1659
1660
/* Python wrapper */
1661
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_3__repr__(PyObject *__pyx_v_self); /*proto*/
1662
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__[] = "File: modular_symbol_map.pyx (starting at line 88)";
1663
#if CYTHON_COMPILING_IN_CPYTHON
1664
struct wrapperbase __pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__;
1665
#endif
1666
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_3__repr__(PyObject *__pyx_v_self) {
1667
PyObject *__pyx_r = 0;
1668
__Pyx_RefNannyDeclarations
1669
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
1670
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
1671
1672
/* function exit code */
1673
__Pyx_RefNannyFinishContext();
1674
return __pyx_r;
1675
}
1676
1677
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
1678
PyObject *__pyx_r = NULL;
1679
__Pyx_RefNannyDeclarations
1680
PyObject *__pyx_t_1 = NULL;
1681
PyObject *__pyx_t_2 = NULL;
1682
PyObject *__pyx_t_3 = NULL;
1683
__Pyx_RefNannySetupContext("__repr__", 0);
1684
1685
/* "psage/modform/rational/modular_symbol_map.pyx":89
1686
*
1687
* def __repr__(self):
1688
* return "Modular symbols map for modular symbols factor of dimension %s and level %s"%(self.d, self.N) # <<<<<<<<<<<<<<
1689
*
1690
* def __init__(self, A):
1691
*/
1692
__Pyx_XDECREF(__pyx_r);
1693
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
1694
__Pyx_GOTREF(__pyx_t_1);
1695
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->N); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
1696
__Pyx_GOTREF(__pyx_t_2);
1697
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
1698
__Pyx_GOTREF(__pyx_t_3);
1699
__Pyx_GIVEREF(__pyx_t_1);
1700
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
1701
__Pyx_GIVEREF(__pyx_t_2);
1702
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
1703
__pyx_t_1 = 0;
1704
__pyx_t_2 = 0;
1705
__pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Modular_symbols_map_for_modular, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
1706
__Pyx_GOTREF(__pyx_t_2);
1707
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1708
__pyx_r = __pyx_t_2;
1709
__pyx_t_2 = 0;
1710
goto __pyx_L0;
1711
1712
/* "psage/modform/rational/modular_symbol_map.pyx":88
1713
* self.X = NULL
1714
*
1715
* def __repr__(self): # <<<<<<<<<<<<<<
1716
* return "Modular symbols map for modular symbols factor of dimension %s and level %s"%(self.d, self.N)
1717
*
1718
*/
1719
1720
/* function exit code */
1721
__pyx_L1_error:;
1722
__Pyx_XDECREF(__pyx_t_1);
1723
__Pyx_XDECREF(__pyx_t_2);
1724
__Pyx_XDECREF(__pyx_t_3);
1725
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1726
__pyx_r = NULL;
1727
__pyx_L0:;
1728
__Pyx_XGIVEREF(__pyx_r);
1729
__Pyx_RefNannyFinishContext();
1730
return __pyx_r;
1731
}
1732
1733
/* "psage/modform/rational/modular_symbol_map.pyx":91
1734
* return "Modular symbols map for modular symbols factor of dimension %s and level %s"%(self.d, self.N)
1735
*
1736
* def __init__(self, A): # <<<<<<<<<<<<<<
1737
* """
1738
* EXAMPLES::
1739
*/
1740
1741
/* Python wrapper */
1742
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1743
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__[] = "File: modular_symbol_map.pyx (starting at line 91)\n\n EXAMPLES::\n\n We illustrate a few ways to construct the modular symbol map for 389a.\n \n sage: from psage.modform.rational.modular_symbol_map import ModularSymbolMap\n sage: A = ModularSymbols(389,sign=1).cuspidal_subspace().new_subspace().decomposition()[0]\n sage: f = ModularSymbolMap(A)\n sage: f._eval1(-3,7)\n [-2]\n sage: f.denom\n 2\n\n sage: E = EllipticCurve('389a'); g = E.modular_symbol()\n sage: h = ModularSymbolMap(g)\n sage: h._eval1(-3,7)\n [-2]\n sage: h.denom\n 1\n sage: g(-3/7)\n -2\n\n sage: f.denom*f.C == h.denom*h.C\n True\n ";
1744
#if CYTHON_COMPILING_IN_CPYTHON
1745
struct wrapperbase __pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__;
1746
#endif
1747
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1748
PyObject *__pyx_v_A = 0;
1749
int __pyx_r;
1750
__Pyx_RefNannyDeclarations
1751
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1752
{
1753
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,0};
1754
PyObject* values[1] = {0};
1755
if (unlikely(__pyx_kwds)) {
1756
Py_ssize_t kw_args;
1757
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1758
switch (pos_args) {
1759
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1760
case 0: break;
1761
default: goto __pyx_L5_argtuple_error;
1762
}
1763
kw_args = PyDict_Size(__pyx_kwds);
1764
switch (pos_args) {
1765
case 0:
1766
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
1767
else goto __pyx_L5_argtuple_error;
1768
}
1769
if (unlikely(kw_args > 0)) {
1770
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
1771
}
1772
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
1773
goto __pyx_L5_argtuple_error;
1774
} else {
1775
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1776
}
1777
__pyx_v_A = values[0];
1778
}
1779
goto __pyx_L4_argument_unpacking_done;
1780
__pyx_L5_argtuple_error:;
1781
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
1782
__pyx_L3_error:;
1783
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1784
__Pyx_RefNannyFinishContext();
1785
return -1;
1786
__pyx_L4_argument_unpacking_done:;
1787
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), __pyx_v_A);
1788
1789
/* function exit code */
1790
__Pyx_RefNannyFinishContext();
1791
return __pyx_r;
1792
}
1793
1794
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_A) {
1795
PyObject *__pyx_v_ell_modular_symbols = NULL;
1796
PyObject *__pyx_v_ModularSymbolsSpace = NULL;
1797
PyObject *__pyx_v_C = NULL;
1798
PyObject *__pyx_v_X = NULL;
1799
Py_ssize_t __pyx_v_n;
1800
PyObject *__pyx_v_a = NULL;
1801
int __pyx_r;
1802
__Pyx_RefNannyDeclarations
1803
PyObject *__pyx_t_1 = NULL;
1804
PyObject *__pyx_t_2 = NULL;
1805
int __pyx_t_3;
1806
int __pyx_t_4;
1807
PyObject *__pyx_t_5 = NULL;
1808
PyObject *__pyx_t_6 = NULL;
1809
PyObject *(*__pyx_t_7)(PyObject *);
1810
long __pyx_t_8;
1811
size_t __pyx_t_9;
1812
Py_ssize_t __pyx_t_10;
1813
PyObject *(*__pyx_t_11)(PyObject *);
1814
__Pyx_RefNannySetupContext("__init__", 0);
1815
1816
/* "psage/modform/rational/modular_symbol_map.pyx":117
1817
* True
1818
* """
1819
* import sage.schemes.elliptic_curves.ell_modular_symbols as ell_modular_symbols # <<<<<<<<<<<<<<
1820
* from sage.modular.modsym.space import ModularSymbolsSpace
1821
*
1822
*/
1823
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
1824
__Pyx_GOTREF(__pyx_t_1);
1825
__Pyx_INCREF(__pyx_n_s_);
1826
__Pyx_GIVEREF(__pyx_n_s_);
1827
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_);
1828
__pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_schemes_elliptic_curves_ell, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
1829
__Pyx_GOTREF(__pyx_t_2);
1830
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1831
__pyx_v_ell_modular_symbols = __pyx_t_2;
1832
__pyx_t_2 = 0;
1833
1834
/* "psage/modform/rational/modular_symbol_map.pyx":118
1835
* """
1836
* import sage.schemes.elliptic_curves.ell_modular_symbols as ell_modular_symbols
1837
* from sage.modular.modsym.space import ModularSymbolsSpace # <<<<<<<<<<<<<<
1838
*
1839
* if isinstance(A, ell_modular_symbols.ModularSymbol):
1840
*/
1841
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
1842
__Pyx_GOTREF(__pyx_t_2);
1843
__Pyx_INCREF(__pyx_n_s_ModularSymbolsSpace);
1844
__Pyx_GIVEREF(__pyx_n_s_ModularSymbolsSpace);
1845
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ModularSymbolsSpace);
1846
__pyx_t_1 = __Pyx_Import(__pyx_n_s_sage_modular_modsym_space, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
1847
__Pyx_GOTREF(__pyx_t_1);
1848
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1849
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_ModularSymbolsSpace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
1850
__Pyx_GOTREF(__pyx_t_2);
1851
__Pyx_INCREF(__pyx_t_2);
1852
__pyx_v_ModularSymbolsSpace = __pyx_t_2;
1853
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1854
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1855
1856
/* "psage/modform/rational/modular_symbol_map.pyx":120
1857
* from sage.modular.modsym.space import ModularSymbolsSpace
1858
*
1859
* if isinstance(A, ell_modular_symbols.ModularSymbol): # <<<<<<<<<<<<<<
1860
* C = self._init_using_ell_modular_symbol(A)
1861
*
1862
*/
1863
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ell_modular_symbols, __pyx_n_s_ModularSymbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
1864
__Pyx_GOTREF(__pyx_t_1);
1865
__pyx_t_3 = PyObject_IsInstance(__pyx_v_A, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 120, __pyx_L1_error)
1866
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1867
__pyx_t_4 = (__pyx_t_3 != 0);
1868
if (__pyx_t_4) {
1869
1870
/* "psage/modform/rational/modular_symbol_map.pyx":121
1871
*
1872
* if isinstance(A, ell_modular_symbols.ModularSymbol):
1873
* C = self._init_using_ell_modular_symbol(A) # <<<<<<<<<<<<<<
1874
*
1875
* elif isinstance(A, ModularSymbolsSpace):
1876
*/
1877
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_using_ell_modular_symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
1878
__Pyx_GOTREF(__pyx_t_2);
1879
__pyx_t_5 = NULL;
1880
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1881
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
1882
if (likely(__pyx_t_5)) {
1883
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1884
__Pyx_INCREF(__pyx_t_5);
1885
__Pyx_INCREF(function);
1886
__Pyx_DECREF_SET(__pyx_t_2, function);
1887
}
1888
}
1889
if (!__pyx_t_5) {
1890
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_A); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
1891
__Pyx_GOTREF(__pyx_t_1);
1892
} else {
1893
#if CYTHON_FAST_PYCALL
1894
if (PyFunction_Check(__pyx_t_2)) {
1895
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_A};
1896
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
1897
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1898
__Pyx_GOTREF(__pyx_t_1);
1899
} else
1900
#endif
1901
#if CYTHON_FAST_PYCCALL
1902
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
1903
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_A};
1904
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
1905
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1906
__Pyx_GOTREF(__pyx_t_1);
1907
} else
1908
#endif
1909
{
1910
__pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error)
1911
__Pyx_GOTREF(__pyx_t_6);
1912
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
1913
__Pyx_INCREF(__pyx_v_A);
1914
__Pyx_GIVEREF(__pyx_v_A);
1915
PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_A);
1916
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
1917
__Pyx_GOTREF(__pyx_t_1);
1918
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1919
}
1920
}
1921
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1922
__pyx_v_C = __pyx_t_1;
1923
__pyx_t_1 = 0;
1924
1925
/* "psage/modform/rational/modular_symbol_map.pyx":120
1926
* from sage.modular.modsym.space import ModularSymbolsSpace
1927
*
1928
* if isinstance(A, ell_modular_symbols.ModularSymbol): # <<<<<<<<<<<<<<
1929
* C = self._init_using_ell_modular_symbol(A)
1930
*
1931
*/
1932
goto __pyx_L3;
1933
}
1934
1935
/* "psage/modform/rational/modular_symbol_map.pyx":123
1936
* C = self._init_using_ell_modular_symbol(A)
1937
*
1938
* elif isinstance(A, ModularSymbolsSpace): # <<<<<<<<<<<<<<
1939
* C = self._init_using_modsym_space(A)
1940
*
1941
*/
1942
__pyx_t_4 = PyObject_IsInstance(__pyx_v_A, __pyx_v_ModularSymbolsSpace); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 123, __pyx_L1_error)
1943
__pyx_t_3 = (__pyx_t_4 != 0);
1944
if (__pyx_t_3) {
1945
1946
/* "psage/modform/rational/modular_symbol_map.pyx":124
1947
*
1948
* elif isinstance(A, ModularSymbolsSpace):
1949
* C = self._init_using_modsym_space(A) # <<<<<<<<<<<<<<
1950
*
1951
* else:
1952
*/
1953
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_using_modsym_space); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
1954
__Pyx_GOTREF(__pyx_t_2);
1955
__pyx_t_6 = NULL;
1956
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1957
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
1958
if (likely(__pyx_t_6)) {
1959
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
1960
__Pyx_INCREF(__pyx_t_6);
1961
__Pyx_INCREF(function);
1962
__Pyx_DECREF_SET(__pyx_t_2, function);
1963
}
1964
}
1965
if (!__pyx_t_6) {
1966
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_A); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
1967
__Pyx_GOTREF(__pyx_t_1);
1968
} else {
1969
#if CYTHON_FAST_PYCALL
1970
if (PyFunction_Check(__pyx_t_2)) {
1971
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_A};
1972
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
1973
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1974
__Pyx_GOTREF(__pyx_t_1);
1975
} else
1976
#endif
1977
#if CYTHON_FAST_PYCCALL
1978
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
1979
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_A};
1980
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
1981
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1982
__Pyx_GOTREF(__pyx_t_1);
1983
} else
1984
#endif
1985
{
1986
__pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
1987
__Pyx_GOTREF(__pyx_t_5);
1988
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
1989
__Pyx_INCREF(__pyx_v_A);
1990
__Pyx_GIVEREF(__pyx_v_A);
1991
PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_A);
1992
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
1993
__Pyx_GOTREF(__pyx_t_1);
1994
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1995
}
1996
}
1997
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1998
__pyx_v_C = __pyx_t_1;
1999
__pyx_t_1 = 0;
2000
2001
/* "psage/modform/rational/modular_symbol_map.pyx":123
2002
* C = self._init_using_ell_modular_symbol(A)
2003
*
2004
* elif isinstance(A, ModularSymbolsSpace): # <<<<<<<<<<<<<<
2005
* C = self._init_using_modsym_space(A)
2006
*
2007
*/
2008
goto __pyx_L3;
2009
}
2010
2011
/* "psage/modform/rational/modular_symbol_map.pyx":128
2012
* else:
2013
*
2014
* raise NotImplementedError, "Creating modular symbols from object of type %s not implemented"%type(A) # <<<<<<<<<<<<<<
2015
*
2016
* # useful for debugging only -- otherwise is a waste of memory/space
2017
*/
2018
/*else*/ {
2019
__pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Creating_modular_symbols_from_ob, ((PyObject *)Py_TYPE(__pyx_v_A))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
2020
__Pyx_GOTREF(__pyx_t_1);
2021
__Pyx_Raise(__pyx_builtin_NotImplementedError, __pyx_t_1, 0, 0);
2022
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2023
__PYX_ERR(0, 128, __pyx_L1_error)
2024
}
2025
__pyx_L3:;
2026
2027
/* "psage/modform/rational/modular_symbol_map.pyx":131
2028
*
2029
* # useful for debugging only -- otherwise is a waste of memory/space
2030
* self.C = C # <<<<<<<<<<<<<<
2031
*
2032
* X, self.denom = C._clear_denom()
2033
*/
2034
__Pyx_INCREF(__pyx_v_C);
2035
__Pyx_GIVEREF(__pyx_v_C);
2036
__Pyx_GOTREF(__pyx_v_self->C);
2037
__Pyx_DECREF(__pyx_v_self->C);
2038
__pyx_v_self->C = __pyx_v_C;
2039
2040
/* "psage/modform/rational/modular_symbol_map.pyx":133
2041
* self.C = C
2042
*
2043
* X, self.denom = C._clear_denom() # <<<<<<<<<<<<<<
2044
* # Now store in a C data structure the entries of X (as long's)
2045
* self.X = <long*>sage_malloc(sizeof(long*)*X.nrows()*X.ncols())
2046
*/
2047
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_C, __pyx_n_s_clear_denom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
2048
__Pyx_GOTREF(__pyx_t_2);
2049
__pyx_t_5 = NULL;
2050
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2051
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
2052
if (likely(__pyx_t_5)) {
2053
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2054
__Pyx_INCREF(__pyx_t_5);
2055
__Pyx_INCREF(function);
2056
__Pyx_DECREF_SET(__pyx_t_2, function);
2057
}
2058
}
2059
if (__pyx_t_5) {
2060
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
2061
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2062
} else {
2063
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
2064
}
2065
__Pyx_GOTREF(__pyx_t_1);
2066
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2067
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
2068
PyObject* sequence = __pyx_t_1;
2069
#if !CYTHON_COMPILING_IN_PYPY
2070
Py_ssize_t size = Py_SIZE(sequence);
2071
#else
2072
Py_ssize_t size = PySequence_Size(sequence);
2073
#endif
2074
if (unlikely(size != 2)) {
2075
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
2076
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2077
__PYX_ERR(0, 133, __pyx_L1_error)
2078
}
2079
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2080
if (likely(PyTuple_CheckExact(sequence))) {
2081
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
2082
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
2083
} else {
2084
__pyx_t_2 = PyList_GET_ITEM(sequence, 0);
2085
__pyx_t_5 = PyList_GET_ITEM(sequence, 1);
2086
}
2087
__Pyx_INCREF(__pyx_t_2);
2088
__Pyx_INCREF(__pyx_t_5);
2089
#else
2090
__pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
2091
__Pyx_GOTREF(__pyx_t_2);
2092
__pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error)
2093
__Pyx_GOTREF(__pyx_t_5);
2094
#endif
2095
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2096
} else {
2097
Py_ssize_t index = -1;
2098
__pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 133, __pyx_L1_error)
2099
__Pyx_GOTREF(__pyx_t_6);
2100
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2101
__pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
2102
index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
2103
__Pyx_GOTREF(__pyx_t_2);
2104
index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
2105
__Pyx_GOTREF(__pyx_t_5);
2106
if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
2107
__pyx_t_7 = NULL;
2108
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2109
goto __pyx_L5_unpacking_done;
2110
__pyx_L4_unpacking_failed:;
2111
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2112
__pyx_t_7 = NULL;
2113
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2114
__PYX_ERR(0, 133, __pyx_L1_error)
2115
__pyx_L5_unpacking_done:;
2116
}
2117
__pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error)
2118
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2119
__pyx_v_X = __pyx_t_2;
2120
__pyx_t_2 = 0;
2121
__pyx_v_self->denom = __pyx_t_8;
2122
2123
/* "psage/modform/rational/modular_symbol_map.pyx":135
2124
* X, self.denom = C._clear_denom()
2125
* # Now store in a C data structure the entries of X (as long's)
2126
* self.X = <long*>sage_malloc(sizeof(long*)*X.nrows()*X.ncols()) # <<<<<<<<<<<<<<
2127
* cdef Py_ssize_t i, j, n
2128
* n = 0
2129
*/
2130
__pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(long *))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
2131
__Pyx_GOTREF(__pyx_t_1);
2132
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_nrows); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
2133
__Pyx_GOTREF(__pyx_t_2);
2134
__pyx_t_6 = NULL;
2135
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2136
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
2137
if (likely(__pyx_t_6)) {
2138
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2139
__Pyx_INCREF(__pyx_t_6);
2140
__Pyx_INCREF(function);
2141
__Pyx_DECREF_SET(__pyx_t_2, function);
2142
}
2143
}
2144
if (__pyx_t_6) {
2145
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
2146
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2147
} else {
2148
__pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
2149
}
2150
__Pyx_GOTREF(__pyx_t_5);
2151
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2152
__pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
2153
__Pyx_GOTREF(__pyx_t_2);
2154
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2155
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2156
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_ncols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
2157
__Pyx_GOTREF(__pyx_t_1);
2158
__pyx_t_6 = NULL;
2159
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2160
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
2161
if (likely(__pyx_t_6)) {
2162
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2163
__Pyx_INCREF(__pyx_t_6);
2164
__Pyx_INCREF(function);
2165
__Pyx_DECREF_SET(__pyx_t_1, function);
2166
}
2167
}
2168
if (__pyx_t_6) {
2169
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
2170
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2171
} else {
2172
__pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
2173
}
2174
__Pyx_GOTREF(__pyx_t_5);
2175
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2176
__pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
2177
__Pyx_GOTREF(__pyx_t_1);
2178
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2179
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2180
__pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
2181
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2182
__pyx_v_self->X = ((long *)sig_malloc(__pyx_t_9));
2183
2184
/* "psage/modform/rational/modular_symbol_map.pyx":137
2185
* self.X = <long*>sage_malloc(sizeof(long*)*X.nrows()*X.ncols())
2186
* cdef Py_ssize_t i, j, n
2187
* n = 0 # <<<<<<<<<<<<<<
2188
* for a in X.list():
2189
* self.X[n] = a
2190
*/
2191
__pyx_v_n = 0;
2192
2193
/* "psage/modform/rational/modular_symbol_map.pyx":138
2194
* cdef Py_ssize_t i, j, n
2195
* n = 0
2196
* for a in X.list(): # <<<<<<<<<<<<<<
2197
* self.X[n] = a
2198
* n += 1
2199
*/
2200
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_list); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error)
2201
__Pyx_GOTREF(__pyx_t_5);
2202
__pyx_t_2 = NULL;
2203
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2204
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
2205
if (likely(__pyx_t_2)) {
2206
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2207
__Pyx_INCREF(__pyx_t_2);
2208
__Pyx_INCREF(function);
2209
__Pyx_DECREF_SET(__pyx_t_5, function);
2210
}
2211
}
2212
if (__pyx_t_2) {
2213
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
2214
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2215
} else {
2216
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
2217
}
2218
__Pyx_GOTREF(__pyx_t_1);
2219
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2220
if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
2221
__pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
2222
__pyx_t_11 = NULL;
2223
} else {
2224
__pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __pyx_L1_error)
2225
__Pyx_GOTREF(__pyx_t_5);
2226
__pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 138, __pyx_L1_error)
2227
}
2228
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2229
for (;;) {
2230
if (likely(!__pyx_t_11)) {
2231
if (likely(PyList_CheckExact(__pyx_t_5))) {
2232
if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
2233
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2234
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 138, __pyx_L1_error)
2235
#else
2236
__pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
2237
__Pyx_GOTREF(__pyx_t_1);
2238
#endif
2239
} else {
2240
if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
2241
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2242
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 138, __pyx_L1_error)
2243
#else
2244
__pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)
2245
__Pyx_GOTREF(__pyx_t_1);
2246
#endif
2247
}
2248
} else {
2249
__pyx_t_1 = __pyx_t_11(__pyx_t_5);
2250
if (unlikely(!__pyx_t_1)) {
2251
PyObject* exc_type = PyErr_Occurred();
2252
if (exc_type) {
2253
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2254
else __PYX_ERR(0, 138, __pyx_L1_error)
2255
}
2256
break;
2257
}
2258
__Pyx_GOTREF(__pyx_t_1);
2259
}
2260
__Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_1);
2261
__pyx_t_1 = 0;
2262
2263
/* "psage/modform/rational/modular_symbol_map.pyx":139
2264
* n = 0
2265
* for a in X.list():
2266
* self.X[n] = a # <<<<<<<<<<<<<<
2267
* n += 1
2268
*
2269
*/
2270
__pyx_t_8 = __Pyx_PyInt_As_long(__pyx_v_a); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error)
2271
(__pyx_v_self->X[__pyx_v_n]) = __pyx_t_8;
2272
2273
/* "psage/modform/rational/modular_symbol_map.pyx":140
2274
* for a in X.list():
2275
* self.X[n] = a
2276
* n += 1 # <<<<<<<<<<<<<<
2277
*
2278
* def _init_using_ell_modular_symbol(self, f):
2279
*/
2280
__pyx_v_n = (__pyx_v_n + 1);
2281
2282
/* "psage/modform/rational/modular_symbol_map.pyx":138
2283
* cdef Py_ssize_t i, j, n
2284
* n = 0
2285
* for a in X.list(): # <<<<<<<<<<<<<<
2286
* self.X[n] = a
2287
* n += 1
2288
*/
2289
}
2290
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2291
2292
/* "psage/modform/rational/modular_symbol_map.pyx":91
2293
* return "Modular symbols map for modular symbols factor of dimension %s and level %s"%(self.d, self.N)
2294
*
2295
* def __init__(self, A): # <<<<<<<<<<<<<<
2296
* """
2297
* EXAMPLES::
2298
*/
2299
2300
/* function exit code */
2301
__pyx_r = 0;
2302
goto __pyx_L0;
2303
__pyx_L1_error:;
2304
__Pyx_XDECREF(__pyx_t_1);
2305
__Pyx_XDECREF(__pyx_t_2);
2306
__Pyx_XDECREF(__pyx_t_5);
2307
__Pyx_XDECREF(__pyx_t_6);
2308
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2309
__pyx_r = -1;
2310
__pyx_L0:;
2311
__Pyx_XDECREF(__pyx_v_ell_modular_symbols);
2312
__Pyx_XDECREF(__pyx_v_ModularSymbolsSpace);
2313
__Pyx_XDECREF(__pyx_v_C);
2314
__Pyx_XDECREF(__pyx_v_X);
2315
__Pyx_XDECREF(__pyx_v_a);
2316
__Pyx_RefNannyFinishContext();
2317
return __pyx_r;
2318
}
2319
2320
/* "psage/modform/rational/modular_symbol_map.pyx":142
2321
* n += 1
2322
*
2323
* def _init_using_ell_modular_symbol(self, f): # <<<<<<<<<<<<<<
2324
* # Input f is an elliptic curve modular symbol map
2325
* assert f.sign() != 0
2326
*/
2327
2328
/* Python wrapper */
2329
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_7_init_using_ell_modular_symbol(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
2330
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_6_init_using_ell_modular_symbol[] = "File: modular_symbol_map.pyx (starting at line 142)";
2331
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_7_init_using_ell_modular_symbol(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
2332
PyObject *__pyx_r = 0;
2333
__Pyx_RefNannyDeclarations
2334
__Pyx_RefNannySetupContext("_init_using_ell_modular_symbol (wrapper)", 0);
2335
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_6_init_using_ell_modular_symbol(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), ((PyObject *)__pyx_v_f));
2336
2337
/* function exit code */
2338
__Pyx_RefNannyFinishContext();
2339
return __pyx_r;
2340
}
2341
2342
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_6_init_using_ell_modular_symbol(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_f) {
2343
PyObject *__pyx_v_E = NULL;
2344
Py_ssize_t __pyx_v_n;
2345
PyObject *__pyx_v_C = NULL;
2346
Py_ssize_t __pyx_v_i;
2347
PyObject *__pyx_v_a = NULL;
2348
PyObject *__pyx_v_b = NULL;
2349
PyObject *__pyx_v_c = NULL;
2350
PyObject *__pyx_v_d = NULL;
2351
PyObject *__pyx_r = NULL;
2352
__Pyx_RefNannyDeclarations
2353
PyObject *__pyx_t_1 = NULL;
2354
PyObject *__pyx_t_2 = NULL;
2355
PyObject *__pyx_t_3 = NULL;
2356
int __pyx_t_4;
2357
long __pyx_t_5;
2358
Py_ssize_t __pyx_t_6;
2359
PyObject *__pyx_t_7 = NULL;
2360
PyObject *__pyx_t_8 = NULL;
2361
int __pyx_t_9;
2362
PyObject *__pyx_t_10 = NULL;
2363
Py_ssize_t __pyx_t_11;
2364
PyObject *(*__pyx_t_12)(PyObject *);
2365
PyObject *__pyx_t_13 = NULL;
2366
__Pyx_RefNannySetupContext("_init_using_ell_modular_symbol", 0);
2367
2368
/* "psage/modform/rational/modular_symbol_map.pyx":144
2369
* def _init_using_ell_modular_symbol(self, f):
2370
* # Input f is an elliptic curve modular symbol map
2371
* assert f.sign() != 0 # <<<<<<<<<<<<<<
2372
* self.d = 1 # the dimension
2373
*
2374
*/
2375
#ifndef CYTHON_WITHOUT_ASSERTIONS
2376
if (unlikely(!Py_OptimizeFlag)) {
2377
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_sign); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
2378
__Pyx_GOTREF(__pyx_t_2);
2379
__pyx_t_3 = NULL;
2380
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2381
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2382
if (likely(__pyx_t_3)) {
2383
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2384
__Pyx_INCREF(__pyx_t_3);
2385
__Pyx_INCREF(function);
2386
__Pyx_DECREF_SET(__pyx_t_2, function);
2387
}
2388
}
2389
if (__pyx_t_3) {
2390
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
2391
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2392
} else {
2393
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
2394
}
2395
__Pyx_GOTREF(__pyx_t_1);
2396
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2397
__pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error)
2398
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2399
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 144, __pyx_L1_error)
2400
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2401
if (unlikely(!__pyx_t_4)) {
2402
PyErr_SetNone(PyExc_AssertionError);
2403
__PYX_ERR(0, 144, __pyx_L1_error)
2404
}
2405
}
2406
#endif
2407
2408
/* "psage/modform/rational/modular_symbol_map.pyx":145
2409
* # Input f is an elliptic curve modular symbol map
2410
* assert f.sign() != 0
2411
* self.d = 1 # the dimension # <<<<<<<<<<<<<<
2412
*
2413
* E = f.elliptic_curve()
2414
*/
2415
__pyx_v_self->d = 1;
2416
2417
/* "psage/modform/rational/modular_symbol_map.pyx":147
2418
* self.d = 1 # the dimension
2419
*
2420
* E = f.elliptic_curve() # <<<<<<<<<<<<<<
2421
* self.N = E.conductor()
2422
* self.P1 = P1List(self.N)
2423
*/
2424
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_elliptic_curve); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
2425
__Pyx_GOTREF(__pyx_t_1);
2426
__pyx_t_3 = NULL;
2427
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2428
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2429
if (likely(__pyx_t_3)) {
2430
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2431
__Pyx_INCREF(__pyx_t_3);
2432
__Pyx_INCREF(function);
2433
__Pyx_DECREF_SET(__pyx_t_1, function);
2434
}
2435
}
2436
if (__pyx_t_3) {
2437
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
2438
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2439
} else {
2440
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
2441
}
2442
__Pyx_GOTREF(__pyx_t_2);
2443
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2444
__pyx_v_E = __pyx_t_2;
2445
__pyx_t_2 = 0;
2446
2447
/* "psage/modform/rational/modular_symbol_map.pyx":148
2448
*
2449
* E = f.elliptic_curve()
2450
* self.N = E.conductor() # <<<<<<<<<<<<<<
2451
* self.P1 = P1List(self.N)
2452
*
2453
*/
2454
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_E, __pyx_n_s_conductor); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
2455
__Pyx_GOTREF(__pyx_t_1);
2456
__pyx_t_3 = NULL;
2457
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2458
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2459
if (likely(__pyx_t_3)) {
2460
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2461
__Pyx_INCREF(__pyx_t_3);
2462
__Pyx_INCREF(function);
2463
__Pyx_DECREF_SET(__pyx_t_1, function);
2464
}
2465
}
2466
if (__pyx_t_3) {
2467
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
2468
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2469
} else {
2470
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
2471
}
2472
__Pyx_GOTREF(__pyx_t_2);
2473
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2474
__pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
2475
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2476
__pyx_v_self->N = __pyx_t_5;
2477
2478
/* "psage/modform/rational/modular_symbol_map.pyx":149
2479
* E = f.elliptic_curve()
2480
* self.N = E.conductor()
2481
* self.P1 = P1List(self.N) # <<<<<<<<<<<<<<
2482
*
2483
* # Make a matrix whose rows are the images of the Manin symbols
2484
*/
2485
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->N); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
2486
__Pyx_GOTREF(__pyx_t_2);
2487
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
2488
__Pyx_GOTREF(__pyx_t_1);
2489
__Pyx_GIVEREF(__pyx_t_2);
2490
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
2491
__pyx_t_2 = 0;
2492
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_7modular_6modsym_6p1list_P1List), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
2493
__Pyx_GOTREF(__pyx_t_2);
2494
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2495
__Pyx_GIVEREF(__pyx_t_2);
2496
__Pyx_GOTREF(__pyx_v_self->P1);
2497
__Pyx_DECREF(((PyObject *)__pyx_v_self->P1));
2498
__pyx_v_self->P1 = ((struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *)__pyx_t_2);
2499
__pyx_t_2 = 0;
2500
2501
/* "psage/modform/rational/modular_symbol_map.pyx":153
2502
* # Make a matrix whose rows are the images of the Manin symbols
2503
* # corresponding to the elements of P^1 under f.
2504
* n = len(self.P1) # <<<<<<<<<<<<<<
2505
* C = matrix(QQ, n, 1)
2506
* for i in range(n):
2507
*/
2508
__pyx_t_2 = ((PyObject *)__pyx_v_self->P1);
2509
__Pyx_INCREF(__pyx_t_2);
2510
__pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 153, __pyx_L1_error)
2511
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2512
__pyx_v_n = __pyx_t_6;
2513
2514
/* "psage/modform/rational/modular_symbol_map.pyx":154
2515
* # corresponding to the elements of P^1 under f.
2516
* n = len(self.P1)
2517
* C = matrix(QQ, n, 1) # <<<<<<<<<<<<<<
2518
* for i in range(n):
2519
* # If the ith element of P1 is (u,v) for some u,v modulo N.
2520
*/
2521
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_matrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
2522
__Pyx_GOTREF(__pyx_t_1);
2523
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_QQ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
2524
__Pyx_GOTREF(__pyx_t_3);
2525
__pyx_t_7 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L1_error)
2526
__Pyx_GOTREF(__pyx_t_7);
2527
__pyx_t_8 = NULL;
2528
__pyx_t_9 = 0;
2529
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
2530
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
2531
if (likely(__pyx_t_8)) {
2532
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2533
__Pyx_INCREF(__pyx_t_8);
2534
__Pyx_INCREF(function);
2535
__Pyx_DECREF_SET(__pyx_t_1, function);
2536
__pyx_t_9 = 1;
2537
}
2538
}
2539
#if CYTHON_FAST_PYCALL
2540
if (PyFunction_Check(__pyx_t_1)) {
2541
PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_t_7, __pyx_int_1};
2542
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
2543
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2544
__Pyx_GOTREF(__pyx_t_2);
2545
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2546
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2547
} else
2548
#endif
2549
#if CYTHON_FAST_PYCCALL
2550
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
2551
PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_3, __pyx_t_7, __pyx_int_1};
2552
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
2553
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2554
__Pyx_GOTREF(__pyx_t_2);
2555
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2556
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2557
} else
2558
#endif
2559
{
2560
__pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L1_error)
2561
__Pyx_GOTREF(__pyx_t_10);
2562
if (__pyx_t_8) {
2563
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
2564
}
2565
__Pyx_GIVEREF(__pyx_t_3);
2566
PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_3);
2567
__Pyx_GIVEREF(__pyx_t_7);
2568
PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
2569
__Pyx_INCREF(__pyx_int_1);
2570
__Pyx_GIVEREF(__pyx_int_1);
2571
PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_int_1);
2572
__pyx_t_3 = 0;
2573
__pyx_t_7 = 0;
2574
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error)
2575
__Pyx_GOTREF(__pyx_t_2);
2576
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2577
}
2578
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2579
__pyx_v_C = __pyx_t_2;
2580
__pyx_t_2 = 0;
2581
2582
/* "psage/modform/rational/modular_symbol_map.pyx":155
2583
* n = len(self.P1)
2584
* C = matrix(QQ, n, 1)
2585
* for i in range(n): # <<<<<<<<<<<<<<
2586
* # If the ith element of P1 is (u,v) for some u,v modulo N.
2587
* # We need to turn this into something we can evaluate f on.
2588
*/
2589
__pyx_t_6 = __pyx_v_n;
2590
for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_6; __pyx_t_11+=1) {
2591
__pyx_v_i = __pyx_t_11;
2592
2593
/* "psage/modform/rational/modular_symbol_map.pyx":162
2594
* # 3. So {b/d, a/c} = {b/d,oo} + {oo,a/c} = -{oo,b/d} + {oo,a/c} = f(a/c)-f(b/d).
2595
* # 4. Thus x |--> f(a/c)-f(b/d).
2596
* a,b,c,d = self.P1.lift_to_sl2z(i) # output are Python ints, so careful! # <<<<<<<<<<<<<<
2597
* C[i,0] = (f(Integer(a)/c) if c else 0) - (f(Integer(b)/d) if d else 0)
2598
* return C
2599
*/
2600
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->P1), __pyx_n_s_lift_to_sl2z); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
2601
__Pyx_GOTREF(__pyx_t_1);
2602
__pyx_t_10 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 162, __pyx_L1_error)
2603
__Pyx_GOTREF(__pyx_t_10);
2604
__pyx_t_7 = NULL;
2605
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2606
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
2607
if (likely(__pyx_t_7)) {
2608
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2609
__Pyx_INCREF(__pyx_t_7);
2610
__Pyx_INCREF(function);
2611
__Pyx_DECREF_SET(__pyx_t_1, function);
2612
}
2613
}
2614
if (!__pyx_t_7) {
2615
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
2616
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2617
__Pyx_GOTREF(__pyx_t_2);
2618
} else {
2619
#if CYTHON_FAST_PYCALL
2620
if (PyFunction_Check(__pyx_t_1)) {
2621
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_10};
2622
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
2623
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2624
__Pyx_GOTREF(__pyx_t_2);
2625
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2626
} else
2627
#endif
2628
#if CYTHON_FAST_PYCCALL
2629
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
2630
PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_10};
2631
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
2632
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2633
__Pyx_GOTREF(__pyx_t_2);
2634
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2635
} else
2636
#endif
2637
{
2638
__pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error)
2639
__Pyx_GOTREF(__pyx_t_3);
2640
__Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
2641
__Pyx_GIVEREF(__pyx_t_10);
2642
PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_10);
2643
__pyx_t_10 = 0;
2644
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
2645
__Pyx_GOTREF(__pyx_t_2);
2646
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2647
}
2648
}
2649
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2650
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
2651
PyObject* sequence = __pyx_t_2;
2652
#if !CYTHON_COMPILING_IN_PYPY
2653
Py_ssize_t size = Py_SIZE(sequence);
2654
#else
2655
Py_ssize_t size = PySequence_Size(sequence);
2656
#endif
2657
if (unlikely(size != 4)) {
2658
if (size > 4) __Pyx_RaiseTooManyValuesError(4);
2659
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
2660
__PYX_ERR(0, 162, __pyx_L1_error)
2661
}
2662
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2663
if (likely(PyTuple_CheckExact(sequence))) {
2664
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
2665
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
2666
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
2667
__pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
2668
} else {
2669
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
2670
__pyx_t_3 = PyList_GET_ITEM(sequence, 1);
2671
__pyx_t_10 = PyList_GET_ITEM(sequence, 2);
2672
__pyx_t_7 = PyList_GET_ITEM(sequence, 3);
2673
}
2674
__Pyx_INCREF(__pyx_t_1);
2675
__Pyx_INCREF(__pyx_t_3);
2676
__Pyx_INCREF(__pyx_t_10);
2677
__Pyx_INCREF(__pyx_t_7);
2678
#else
2679
{
2680
Py_ssize_t i;
2681
PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_10,&__pyx_t_7};
2682
for (i=0; i < 4; i++) {
2683
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 162, __pyx_L1_error)
2684
__Pyx_GOTREF(item);
2685
*(temps[i]) = item;
2686
}
2687
}
2688
#endif
2689
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2690
} else {
2691
Py_ssize_t index = -1;
2692
PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_10,&__pyx_t_7};
2693
__pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error)
2694
__Pyx_GOTREF(__pyx_t_8);
2695
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2696
__pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext;
2697
for (index=0; index < 4; index++) {
2698
PyObject* item = __pyx_t_12(__pyx_t_8); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
2699
__Pyx_GOTREF(item);
2700
*(temps[index]) = item;
2701
}
2702
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_8), 4) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
2703
__pyx_t_12 = NULL;
2704
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2705
goto __pyx_L6_unpacking_done;
2706
__pyx_L5_unpacking_failed:;
2707
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2708
__pyx_t_12 = NULL;
2709
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
2710
__PYX_ERR(0, 162, __pyx_L1_error)
2711
__pyx_L6_unpacking_done:;
2712
}
2713
__Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_1);
2714
__pyx_t_1 = 0;
2715
__Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_3);
2716
__pyx_t_3 = 0;
2717
__Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_10);
2718
__pyx_t_10 = 0;
2719
__Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_7);
2720
__pyx_t_7 = 0;
2721
2722
/* "psage/modform/rational/modular_symbol_map.pyx":163
2723
* # 4. Thus x |--> f(a/c)-f(b/d).
2724
* a,b,c,d = self.P1.lift_to_sl2z(i) # output are Python ints, so careful!
2725
* C[i,0] = (f(Integer(a)/c) if c else 0) - (f(Integer(b)/d) if d else 0) # <<<<<<<<<<<<<<
2726
* return C
2727
*
2728
*/
2729
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_c); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
2730
if (__pyx_t_4) {
2731
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Integer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
2732
__Pyx_GOTREF(__pyx_t_3);
2733
__pyx_t_1 = NULL;
2734
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2735
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
2736
if (likely(__pyx_t_1)) {
2737
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2738
__Pyx_INCREF(__pyx_t_1);
2739
__Pyx_INCREF(function);
2740
__Pyx_DECREF_SET(__pyx_t_3, function);
2741
}
2742
}
2743
if (!__pyx_t_1) {
2744
__pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_a); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2745
__Pyx_GOTREF(__pyx_t_10);
2746
} else {
2747
#if CYTHON_FAST_PYCALL
2748
if (PyFunction_Check(__pyx_t_3)) {
2749
PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_a};
2750
__pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2751
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2752
__Pyx_GOTREF(__pyx_t_10);
2753
} else
2754
#endif
2755
#if CYTHON_FAST_PYCCALL
2756
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2757
PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_a};
2758
__pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2759
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2760
__Pyx_GOTREF(__pyx_t_10);
2761
} else
2762
#endif
2763
{
2764
__pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 163, __pyx_L1_error)
2765
__Pyx_GOTREF(__pyx_t_8);
2766
__Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL;
2767
__Pyx_INCREF(__pyx_v_a);
2768
__Pyx_GIVEREF(__pyx_v_a);
2769
PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_a);
2770
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2771
__Pyx_GOTREF(__pyx_t_10);
2772
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2773
}
2774
}
2775
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2776
__pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
2777
__Pyx_GOTREF(__pyx_t_3);
2778
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2779
__Pyx_INCREF(__pyx_v_f);
2780
__pyx_t_10 = __pyx_v_f; __pyx_t_8 = NULL;
2781
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
2782
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
2783
if (likely(__pyx_t_8)) {
2784
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
2785
__Pyx_INCREF(__pyx_t_8);
2786
__Pyx_INCREF(function);
2787
__Pyx_DECREF_SET(__pyx_t_10, function);
2788
}
2789
}
2790
if (!__pyx_t_8) {
2791
__pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
2792
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2793
__Pyx_GOTREF(__pyx_t_7);
2794
} else {
2795
#if CYTHON_FAST_PYCALL
2796
if (PyFunction_Check(__pyx_t_10)) {
2797
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
2798
__pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
2799
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2800
__Pyx_GOTREF(__pyx_t_7);
2801
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2802
} else
2803
#endif
2804
#if CYTHON_FAST_PYCCALL
2805
if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
2806
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
2807
__pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
2808
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2809
__Pyx_GOTREF(__pyx_t_7);
2810
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2811
} else
2812
#endif
2813
{
2814
__pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2815
__Pyx_GOTREF(__pyx_t_1);
2816
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
2817
__Pyx_GIVEREF(__pyx_t_3);
2818
PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_3);
2819
__pyx_t_3 = 0;
2820
__pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
2821
__Pyx_GOTREF(__pyx_t_7);
2822
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2823
}
2824
}
2825
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2826
__pyx_t_2 = __pyx_t_7;
2827
__pyx_t_7 = 0;
2828
} else {
2829
__Pyx_INCREF(__pyx_int_0);
2830
__pyx_t_2 = __pyx_int_0;
2831
}
2832
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
2833
if (__pyx_t_4) {
2834
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Integer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
2835
__Pyx_GOTREF(__pyx_t_3);
2836
__pyx_t_8 = NULL;
2837
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2838
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
2839
if (likely(__pyx_t_8)) {
2840
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2841
__Pyx_INCREF(__pyx_t_8);
2842
__Pyx_INCREF(function);
2843
__Pyx_DECREF_SET(__pyx_t_3, function);
2844
}
2845
}
2846
if (!__pyx_t_8) {
2847
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2848
__Pyx_GOTREF(__pyx_t_1);
2849
} else {
2850
#if CYTHON_FAST_PYCALL
2851
if (PyFunction_Check(__pyx_t_3)) {
2852
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_b};
2853
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2854
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2855
__Pyx_GOTREF(__pyx_t_1);
2856
} else
2857
#endif
2858
#if CYTHON_FAST_PYCCALL
2859
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2860
PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_b};
2861
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2862
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
2863
__Pyx_GOTREF(__pyx_t_1);
2864
} else
2865
#endif
2866
{
2867
__pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 163, __pyx_L1_error)
2868
__Pyx_GOTREF(__pyx_t_13);
2869
__Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8); __pyx_t_8 = NULL;
2870
__Pyx_INCREF(__pyx_v_b);
2871
__Pyx_GIVEREF(__pyx_v_b);
2872
PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_b);
2873
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)
2874
__Pyx_GOTREF(__pyx_t_1);
2875
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
2876
}
2877
}
2878
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2879
__pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
2880
__Pyx_GOTREF(__pyx_t_3);
2881
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2882
__Pyx_INCREF(__pyx_v_f);
2883
__pyx_t_1 = __pyx_v_f; __pyx_t_13 = NULL;
2884
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
2885
__pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
2886
if (likely(__pyx_t_13)) {
2887
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2888
__Pyx_INCREF(__pyx_t_13);
2889
__Pyx_INCREF(function);
2890
__Pyx_DECREF_SET(__pyx_t_1, function);
2891
}
2892
}
2893
if (!__pyx_t_13) {
2894
__pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2895
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2896
__Pyx_GOTREF(__pyx_t_10);
2897
} else {
2898
#if CYTHON_FAST_PYCALL
2899
if (PyFunction_Check(__pyx_t_1)) {
2900
PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_3};
2901
__pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2902
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2903
__Pyx_GOTREF(__pyx_t_10);
2904
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2905
} else
2906
#endif
2907
#if CYTHON_FAST_PYCCALL
2908
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
2909
PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_3};
2910
__pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2911
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
2912
__Pyx_GOTREF(__pyx_t_10);
2913
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2914
} else
2915
#endif
2916
{
2917
__pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 163, __pyx_L1_error)
2918
__Pyx_GOTREF(__pyx_t_8);
2919
__Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13); __pyx_t_13 = NULL;
2920
__Pyx_GIVEREF(__pyx_t_3);
2921
PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3);
2922
__pyx_t_3 = 0;
2923
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2924
__Pyx_GOTREF(__pyx_t_10);
2925
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2926
}
2927
}
2928
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2929
__pyx_t_7 = __pyx_t_10;
2930
__pyx_t_10 = 0;
2931
} else {
2932
__Pyx_INCREF(__pyx_int_0);
2933
__pyx_t_7 = __pyx_int_0;
2934
}
2935
__pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error)
2936
__Pyx_GOTREF(__pyx_t_10);
2937
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2938
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2939
__pyx_t_7 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 163, __pyx_L1_error)
2940
__Pyx_GOTREF(__pyx_t_7);
2941
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
2942
__Pyx_GOTREF(__pyx_t_2);
2943
__Pyx_GIVEREF(__pyx_t_7);
2944
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
2945
__Pyx_INCREF(__pyx_int_0);
2946
__Pyx_GIVEREF(__pyx_int_0);
2947
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
2948
__pyx_t_7 = 0;
2949
if (unlikely(PyObject_SetItem(__pyx_v_C, __pyx_t_2, __pyx_t_10) < 0)) __PYX_ERR(0, 163, __pyx_L1_error)
2950
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2951
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
2952
}
2953
2954
/* "psage/modform/rational/modular_symbol_map.pyx":164
2955
* a,b,c,d = self.P1.lift_to_sl2z(i) # output are Python ints, so careful!
2956
* C[i,0] = (f(Integer(a)/c) if c else 0) - (f(Integer(b)/d) if d else 0)
2957
* return C # <<<<<<<<<<<<<<
2958
*
2959
* def _init_using_modsym_space(self, A):
2960
*/
2961
__Pyx_XDECREF(__pyx_r);
2962
__Pyx_INCREF(__pyx_v_C);
2963
__pyx_r = __pyx_v_C;
2964
goto __pyx_L0;
2965
2966
/* "psage/modform/rational/modular_symbol_map.pyx":142
2967
* n += 1
2968
*
2969
* def _init_using_ell_modular_symbol(self, f): # <<<<<<<<<<<<<<
2970
* # Input f is an elliptic curve modular symbol map
2971
* assert f.sign() != 0
2972
*/
2973
2974
/* function exit code */
2975
__pyx_L1_error:;
2976
__Pyx_XDECREF(__pyx_t_1);
2977
__Pyx_XDECREF(__pyx_t_2);
2978
__Pyx_XDECREF(__pyx_t_3);
2979
__Pyx_XDECREF(__pyx_t_7);
2980
__Pyx_XDECREF(__pyx_t_8);
2981
__Pyx_XDECREF(__pyx_t_10);
2982
__Pyx_XDECREF(__pyx_t_13);
2983
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap._init_using_ell_modular_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
2984
__pyx_r = NULL;
2985
__pyx_L0:;
2986
__Pyx_XDECREF(__pyx_v_E);
2987
__Pyx_XDECREF(__pyx_v_C);
2988
__Pyx_XDECREF(__pyx_v_a);
2989
__Pyx_XDECREF(__pyx_v_b);
2990
__Pyx_XDECREF(__pyx_v_c);
2991
__Pyx_XDECREF(__pyx_v_d);
2992
__Pyx_XGIVEREF(__pyx_r);
2993
__Pyx_RefNannyFinishContext();
2994
return __pyx_r;
2995
}
2996
2997
/* "psage/modform/rational/modular_symbol_map.pyx":166
2998
* return C
2999
*
3000
* def _init_using_modsym_space(self, A): # <<<<<<<<<<<<<<
3001
* # Very slow generic setup code. This is "O(1)" in that we
3002
* # care mainly about evaluation time being fast, at least in
3003
*/
3004
3005
/* Python wrapper */
3006
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_9_init_using_modsym_space(PyObject *__pyx_v_self, PyObject *__pyx_v_A); /*proto*/
3007
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_8_init_using_modsym_space[] = "File: modular_symbol_map.pyx (starting at line 166)";
3008
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_9_init_using_modsym_space(PyObject *__pyx_v_self, PyObject *__pyx_v_A) {
3009
PyObject *__pyx_r = 0;
3010
__Pyx_RefNannyDeclarations
3011
__Pyx_RefNannySetupContext("_init_using_modsym_space (wrapper)", 0);
3012
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_8_init_using_modsym_space(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), ((PyObject *)__pyx_v_A));
3013
3014
/* function exit code */
3015
__Pyx_RefNannyFinishContext();
3016
return __pyx_r;
3017
}
3018
3019
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_8_init_using_modsym_space(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_A) {
3020
PyObject *__pyx_v_M = NULL;
3021
PyObject *__pyx_v_W = NULL;
3022
PyObject *__pyx_v_B = NULL;
3023
PyObject *__pyx_v_x = NULL;
3024
PyObject *__pyx_r = NULL;
3025
__Pyx_RefNannyDeclarations
3026
PyObject *__pyx_t_1 = NULL;
3027
PyObject *__pyx_t_2 = NULL;
3028
PyObject *__pyx_t_3 = NULL;
3029
int __pyx_t_4;
3030
long __pyx_t_5;
3031
PyObject *__pyx_t_6 = NULL;
3032
Py_ssize_t __pyx_t_7;
3033
PyObject *(*__pyx_t_8)(PyObject *);
3034
PyObject *__pyx_t_9 = NULL;
3035
PyObject *__pyx_t_10 = NULL;
3036
PyObject *__pyx_t_11 = NULL;
3037
PyObject *__pyx_t_12 = NULL;
3038
PyObject *__pyx_t_13 = NULL;
3039
__Pyx_RefNannySetupContext("_init_using_modsym_space", 0);
3040
3041
/* "psage/modform/rational/modular_symbol_map.pyx":170
3042
* # care mainly about evaluation time being fast, at least in
3043
* # this code.
3044
* if A.sign() == 0: # <<<<<<<<<<<<<<
3045
* raise ValueError, "A must have sign +1 or -1"
3046
* self.d = A.dimension()
3047
*/
3048
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_sign); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error)
3049
__Pyx_GOTREF(__pyx_t_2);
3050
__pyx_t_3 = NULL;
3051
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3052
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3053
if (likely(__pyx_t_3)) {
3054
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3055
__Pyx_INCREF(__pyx_t_3);
3056
__Pyx_INCREF(function);
3057
__Pyx_DECREF_SET(__pyx_t_2, function);
3058
}
3059
}
3060
if (__pyx_t_3) {
3061
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
3062
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3063
} else {
3064
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
3065
}
3066
__Pyx_GOTREF(__pyx_t_1);
3067
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3068
__pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error)
3069
__Pyx_GOTREF(__pyx_t_2);
3070
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3071
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 170, __pyx_L1_error)
3072
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3073
if (__pyx_t_4) {
3074
3075
/* "psage/modform/rational/modular_symbol_map.pyx":171
3076
* # this code.
3077
* if A.sign() == 0:
3078
* raise ValueError, "A must have sign +1 or -1" # <<<<<<<<<<<<<<
3079
* self.d = A.dimension()
3080
*
3081
*/
3082
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_A_must_have_sign_1_or_1, 0, 0);
3083
__PYX_ERR(0, 171, __pyx_L1_error)
3084
3085
/* "psage/modform/rational/modular_symbol_map.pyx":170
3086
* # care mainly about evaluation time being fast, at least in
3087
* # this code.
3088
* if A.sign() == 0: # <<<<<<<<<<<<<<
3089
* raise ValueError, "A must have sign +1 or -1"
3090
* self.d = A.dimension()
3091
*/
3092
}
3093
3094
/* "psage/modform/rational/modular_symbol_map.pyx":172
3095
* if A.sign() == 0:
3096
* raise ValueError, "A must have sign +1 or -1"
3097
* self.d = A.dimension() # <<<<<<<<<<<<<<
3098
*
3099
* self.N = A.level()
3100
*/
3101
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_dimension); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
3102
__Pyx_GOTREF(__pyx_t_1);
3103
__pyx_t_3 = NULL;
3104
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
3105
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
3106
if (likely(__pyx_t_3)) {
3107
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3108
__Pyx_INCREF(__pyx_t_3);
3109
__Pyx_INCREF(function);
3110
__Pyx_DECREF_SET(__pyx_t_1, function);
3111
}
3112
}
3113
if (__pyx_t_3) {
3114
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
3115
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3116
} else {
3117
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
3118
}
3119
__Pyx_GOTREF(__pyx_t_2);
3120
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3121
__pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L1_error)
3122
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3123
__pyx_v_self->d = __pyx_t_5;
3124
3125
/* "psage/modform/rational/modular_symbol_map.pyx":174
3126
* self.d = A.dimension()
3127
*
3128
* self.N = A.level() # <<<<<<<<<<<<<<
3129
* self.P1 = P1List(self.N)
3130
*
3131
*/
3132
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
3133
__Pyx_GOTREF(__pyx_t_1);
3134
__pyx_t_3 = NULL;
3135
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
3136
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
3137
if (likely(__pyx_t_3)) {
3138
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3139
__Pyx_INCREF(__pyx_t_3);
3140
__Pyx_INCREF(function);
3141
__Pyx_DECREF_SET(__pyx_t_1, function);
3142
}
3143
}
3144
if (__pyx_t_3) {
3145
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
3146
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3147
} else {
3148
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
3149
}
3150
__Pyx_GOTREF(__pyx_t_2);
3151
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3152
__pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error)
3153
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3154
__pyx_v_self->N = __pyx_t_5;
3155
3156
/* "psage/modform/rational/modular_symbol_map.pyx":175
3157
*
3158
* self.N = A.level()
3159
* self.P1 = P1List(self.N) # <<<<<<<<<<<<<<
3160
*
3161
* # The key data we need from the modular symbols space is the
3162
*/
3163
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->N); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
3164
__Pyx_GOTREF(__pyx_t_2);
3165
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
3166
__Pyx_GOTREF(__pyx_t_1);
3167
__Pyx_GIVEREF(__pyx_t_2);
3168
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
3169
__pyx_t_2 = 0;
3170
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_4sage_7modular_6modsym_6p1list_P1List), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
3171
__Pyx_GOTREF(__pyx_t_2);
3172
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3173
__Pyx_GIVEREF(__pyx_t_2);
3174
__Pyx_GOTREF(__pyx_v_self->P1);
3175
__Pyx_DECREF(((PyObject *)__pyx_v_self->P1));
3176
__pyx_v_self->P1 = ((struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *)__pyx_t_2);
3177
__pyx_t_2 = 0;
3178
3179
/* "psage/modform/rational/modular_symbol_map.pyx":180
3180
* # map that assigns to an element of P1 the corresponding
3181
* # element of ZZ^n. That's it. We forget everything else.
3182
* M = A.ambient_module() # <<<<<<<<<<<<<<
3183
* W = matrix([M.manin_symbol(x).element() for x in self.P1])
3184
* B = A.dual_free_module().basis_matrix().transpose()
3185
*/
3186
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_ambient_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
3187
__Pyx_GOTREF(__pyx_t_1);
3188
__pyx_t_3 = NULL;
3189
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
3190
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
3191
if (likely(__pyx_t_3)) {
3192
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3193
__Pyx_INCREF(__pyx_t_3);
3194
__Pyx_INCREF(function);
3195
__Pyx_DECREF_SET(__pyx_t_1, function);
3196
}
3197
}
3198
if (__pyx_t_3) {
3199
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
3200
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3201
} else {
3202
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
3203
}
3204
__Pyx_GOTREF(__pyx_t_2);
3205
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3206
__pyx_v_M = __pyx_t_2;
3207
__pyx_t_2 = 0;
3208
3209
/* "psage/modform/rational/modular_symbol_map.pyx":181
3210
* # element of ZZ^n. That's it. We forget everything else.
3211
* M = A.ambient_module()
3212
* W = matrix([M.manin_symbol(x).element() for x in self.P1]) # <<<<<<<<<<<<<<
3213
* B = A.dual_free_module().basis_matrix().transpose()
3214
*
3215
*/
3216
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_matrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
3217
__Pyx_GOTREF(__pyx_t_1);
3218
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
3219
__Pyx_GOTREF(__pyx_t_3);
3220
if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self->P1))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self->P1))) {
3221
__pyx_t_6 = ((PyObject *)__pyx_v_self->P1); __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
3222
__pyx_t_8 = NULL;
3223
} else {
3224
__pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(((PyObject *)__pyx_v_self->P1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error)
3225
__Pyx_GOTREF(__pyx_t_6);
3226
__pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 181, __pyx_L1_error)
3227
}
3228
for (;;) {
3229
if (likely(!__pyx_t_8)) {
3230
if (likely(PyList_CheckExact(__pyx_t_6))) {
3231
if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
3232
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3233
__pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
3234
#else
3235
__pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error)
3236
__Pyx_GOTREF(__pyx_t_9);
3237
#endif
3238
} else {
3239
if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
3240
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3241
__pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 181, __pyx_L1_error)
3242
#else
3243
__pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error)
3244
__Pyx_GOTREF(__pyx_t_9);
3245
#endif
3246
}
3247
} else {
3248
__pyx_t_9 = __pyx_t_8(__pyx_t_6);
3249
if (unlikely(!__pyx_t_9)) {
3250
PyObject* exc_type = PyErr_Occurred();
3251
if (exc_type) {
3252
if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3253
else __PYX_ERR(0, 181, __pyx_L1_error)
3254
}
3255
break;
3256
}
3257
__Pyx_GOTREF(__pyx_t_9);
3258
}
3259
__Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_9);
3260
__pyx_t_9 = 0;
3261
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_M, __pyx_n_s_manin_symbol); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 181, __pyx_L1_error)
3262
__Pyx_GOTREF(__pyx_t_11);
3263
__pyx_t_12 = NULL;
3264
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
3265
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
3266
if (likely(__pyx_t_12)) {
3267
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
3268
__Pyx_INCREF(__pyx_t_12);
3269
__Pyx_INCREF(function);
3270
__Pyx_DECREF_SET(__pyx_t_11, function);
3271
}
3272
}
3273
if (!__pyx_t_12) {
3274
__pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_x); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 181, __pyx_L1_error)
3275
__Pyx_GOTREF(__pyx_t_10);
3276
} else {
3277
#if CYTHON_FAST_PYCALL
3278
if (PyFunction_Check(__pyx_t_11)) {
3279
PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_v_x};
3280
__pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 181, __pyx_L1_error)
3281
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
3282
__Pyx_GOTREF(__pyx_t_10);
3283
} else
3284
#endif
3285
#if CYTHON_FAST_PYCCALL
3286
if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
3287
PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_v_x};
3288
__pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 181, __pyx_L1_error)
3289
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
3290
__Pyx_GOTREF(__pyx_t_10);
3291
} else
3292
#endif
3293
{
3294
__pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 181, __pyx_L1_error)
3295
__Pyx_GOTREF(__pyx_t_13);
3296
__Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
3297
__Pyx_INCREF(__pyx_v_x);
3298
__Pyx_GIVEREF(__pyx_v_x);
3299
PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_x);
3300
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 181, __pyx_L1_error)
3301
__Pyx_GOTREF(__pyx_t_10);
3302
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3303
}
3304
}
3305
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3306
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_element); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 181, __pyx_L1_error)
3307
__Pyx_GOTREF(__pyx_t_11);
3308
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3309
__pyx_t_10 = NULL;
3310
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
3311
__pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
3312
if (likely(__pyx_t_10)) {
3313
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
3314
__Pyx_INCREF(__pyx_t_10);
3315
__Pyx_INCREF(function);
3316
__Pyx_DECREF_SET(__pyx_t_11, function);
3317
}
3318
}
3319
if (__pyx_t_10) {
3320
__pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error)
3321
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3322
} else {
3323
__pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error)
3324
}
3325
__Pyx_GOTREF(__pyx_t_9);
3326
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3327
if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 181, __pyx_L1_error)
3328
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3329
}
3330
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3331
__pyx_t_6 = NULL;
3332
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
3333
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
3334
if (likely(__pyx_t_6)) {
3335
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3336
__Pyx_INCREF(__pyx_t_6);
3337
__Pyx_INCREF(function);
3338
__Pyx_DECREF_SET(__pyx_t_1, function);
3339
}
3340
}
3341
if (!__pyx_t_6) {
3342
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
3343
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3344
__Pyx_GOTREF(__pyx_t_2);
3345
} else {
3346
#if CYTHON_FAST_PYCALL
3347
if (PyFunction_Check(__pyx_t_1)) {
3348
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
3349
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
3350
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3351
__Pyx_GOTREF(__pyx_t_2);
3352
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3353
} else
3354
#endif
3355
#if CYTHON_FAST_PYCCALL
3356
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
3357
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
3358
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
3359
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3360
__Pyx_GOTREF(__pyx_t_2);
3361
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3362
} else
3363
#endif
3364
{
3365
__pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 181, __pyx_L1_error)
3366
__Pyx_GOTREF(__pyx_t_9);
3367
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
3368
__Pyx_GIVEREF(__pyx_t_3);
3369
PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
3370
__pyx_t_3 = 0;
3371
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
3372
__Pyx_GOTREF(__pyx_t_2);
3373
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3374
}
3375
}
3376
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3377
__pyx_v_W = __pyx_t_2;
3378
__pyx_t_2 = 0;
3379
3380
/* "psage/modform/rational/modular_symbol_map.pyx":182
3381
* M = A.ambient_module()
3382
* W = matrix([M.manin_symbol(x).element() for x in self.P1])
3383
* B = A.dual_free_module().basis_matrix().transpose() # <<<<<<<<<<<<<<
3384
*
3385
* # Return matrix whose rows are the images of the Manin symbols
3386
*/
3387
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_dual_free_module); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
3388
__Pyx_GOTREF(__pyx_t_3);
3389
__pyx_t_6 = NULL;
3390
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3391
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
3392
if (likely(__pyx_t_6)) {
3393
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3394
__Pyx_INCREF(__pyx_t_6);
3395
__Pyx_INCREF(function);
3396
__Pyx_DECREF_SET(__pyx_t_3, function);
3397
}
3398
}
3399
if (__pyx_t_6) {
3400
__pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error)
3401
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3402
} else {
3403
__pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 182, __pyx_L1_error)
3404
}
3405
__Pyx_GOTREF(__pyx_t_9);
3406
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3407
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_basis_matrix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
3408
__Pyx_GOTREF(__pyx_t_3);
3409
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3410
__pyx_t_9 = NULL;
3411
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3412
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
3413
if (likely(__pyx_t_9)) {
3414
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3415
__Pyx_INCREF(__pyx_t_9);
3416
__Pyx_INCREF(function);
3417
__Pyx_DECREF_SET(__pyx_t_3, function);
3418
}
3419
}
3420
if (__pyx_t_9) {
3421
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
3422
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3423
} else {
3424
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
3425
}
3426
__Pyx_GOTREF(__pyx_t_1);
3427
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3428
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_transpose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
3429
__Pyx_GOTREF(__pyx_t_3);
3430
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3431
__pyx_t_1 = NULL;
3432
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3433
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
3434
if (likely(__pyx_t_1)) {
3435
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3436
__Pyx_INCREF(__pyx_t_1);
3437
__Pyx_INCREF(function);
3438
__Pyx_DECREF_SET(__pyx_t_3, function);
3439
}
3440
}
3441
if (__pyx_t_1) {
3442
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
3443
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3444
} else {
3445
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
3446
}
3447
__Pyx_GOTREF(__pyx_t_2);
3448
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3449
__pyx_v_B = __pyx_t_2;
3450
__pyx_t_2 = 0;
3451
3452
/* "psage/modform/rational/modular_symbol_map.pyx":187
3453
* # corresponding to the elements of P^1 under the modular
3454
* # symbol map.
3455
* return W*B # <<<<<<<<<<<<<<
3456
*
3457
*
3458
*/
3459
__Pyx_XDECREF(__pyx_r);
3460
__pyx_t_2 = PyNumber_Multiply(__pyx_v_W, __pyx_v_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error)
3461
__Pyx_GOTREF(__pyx_t_2);
3462
__pyx_r = __pyx_t_2;
3463
__pyx_t_2 = 0;
3464
goto __pyx_L0;
3465
3466
/* "psage/modform/rational/modular_symbol_map.pyx":166
3467
* return C
3468
*
3469
* def _init_using_modsym_space(self, A): # <<<<<<<<<<<<<<
3470
* # Very slow generic setup code. This is "O(1)" in that we
3471
* # care mainly about evaluation time being fast, at least in
3472
*/
3473
3474
/* function exit code */
3475
__pyx_L1_error:;
3476
__Pyx_XDECREF(__pyx_t_1);
3477
__Pyx_XDECREF(__pyx_t_2);
3478
__Pyx_XDECREF(__pyx_t_3);
3479
__Pyx_XDECREF(__pyx_t_6);
3480
__Pyx_XDECREF(__pyx_t_9);
3481
__Pyx_XDECREF(__pyx_t_10);
3482
__Pyx_XDECREF(__pyx_t_11);
3483
__Pyx_XDECREF(__pyx_t_12);
3484
__Pyx_XDECREF(__pyx_t_13);
3485
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap._init_using_modsym_space", __pyx_clineno, __pyx_lineno, __pyx_filename);
3486
__pyx_r = NULL;
3487
__pyx_L0:;
3488
__Pyx_XDECREF(__pyx_v_M);
3489
__Pyx_XDECREF(__pyx_v_W);
3490
__Pyx_XDECREF(__pyx_v_B);
3491
__Pyx_XDECREF(__pyx_v_x);
3492
__Pyx_XGIVEREF(__pyx_r);
3493
__Pyx_RefNannyFinishContext();
3494
return __pyx_r;
3495
}
3496
3497
/* "psage/modform/rational/modular_symbol_map.pyx":190
3498
*
3499
*
3500
* def __dealloc__(self): # <<<<<<<<<<<<<<
3501
* if self.X:
3502
* sage_free(self.X)
3503
*/
3504
3505
/* Python wrapper */
3506
static void __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_11__dealloc__(PyObject *__pyx_v_self); /*proto*/
3507
static void __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_11__dealloc__(PyObject *__pyx_v_self) {
3508
__Pyx_RefNannyDeclarations
3509
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
3510
__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_10__dealloc__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
3511
3512
/* function exit code */
3513
__Pyx_RefNannyFinishContext();
3514
}
3515
3516
static void __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_10__dealloc__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
3517
__Pyx_RefNannyDeclarations
3518
int __pyx_t_1;
3519
__Pyx_RefNannySetupContext("__dealloc__", 0);
3520
3521
/* "psage/modform/rational/modular_symbol_map.pyx":191
3522
*
3523
* def __dealloc__(self):
3524
* if self.X: # <<<<<<<<<<<<<<
3525
* sage_free(self.X)
3526
*
3527
*/
3528
__pyx_t_1 = (__pyx_v_self->X != 0);
3529
if (__pyx_t_1) {
3530
3531
/* "psage/modform/rational/modular_symbol_map.pyx":192
3532
* def __dealloc__(self):
3533
* if self.X:
3534
* sage_free(self.X) # <<<<<<<<<<<<<<
3535
*
3536
* cdef int evaluate(self, long v[MAX_DEG], long a, long b) except -1:
3537
*/
3538
sig_free(__pyx_v_self->X);
3539
3540
/* "psage/modform/rational/modular_symbol_map.pyx":191
3541
*
3542
* def __dealloc__(self):
3543
* if self.X: # <<<<<<<<<<<<<<
3544
* sage_free(self.X)
3545
*
3546
*/
3547
}
3548
3549
/* "psage/modform/rational/modular_symbol_map.pyx":190
3550
*
3551
*
3552
* def __dealloc__(self): # <<<<<<<<<<<<<<
3553
* if self.X:
3554
* sage_free(self.X)
3555
*/
3556
3557
/* function exit code */
3558
__Pyx_RefNannyFinishContext();
3559
}
3560
3561
/* "psage/modform/rational/modular_symbol_map.pyx":194
3562
* sage_free(self.X)
3563
*
3564
* cdef int evaluate(self, long v[MAX_DEG], long a, long b) except -1: # <<<<<<<<<<<<<<
3565
* cdef long q[MAX_CONTFRAC]
3566
* cdef int i, j, k, n, sign=1
3567
*/
3568
3569
static int __pyx_f_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_evaluate(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, long *__pyx_v_v, long __pyx_v_a, long __pyx_v_b) {
3570
long __pyx_v_q[__pyx_e_5psage_7modform_8rational_18modular_symbol_map_MAX_CONTFRAC];
3571
int __pyx_v_i;
3572
int __pyx_v_j;
3573
int __pyx_v_k;
3574
int __pyx_v_n;
3575
int __pyx_v_sign;
3576
long *__pyx_v_x;
3577
int __pyx_r;
3578
__Pyx_RefNannyDeclarations
3579
long __pyx_t_1;
3580
int __pyx_t_2;
3581
int __pyx_t_3;
3582
long __pyx_t_4;
3583
PyObject *__pyx_t_5 = NULL;
3584
int __pyx_t_6;
3585
int __pyx_t_7;
3586
__Pyx_RefNannySetupContext("evaluate", 0);
3587
3588
/* "psage/modform/rational/modular_symbol_map.pyx":196
3589
* cdef int evaluate(self, long v[MAX_DEG], long a, long b) except -1:
3590
* cdef long q[MAX_CONTFRAC]
3591
* cdef int i, j, k, n, sign=1 # <<<<<<<<<<<<<<
3592
* cdef long* x
3593
*
3594
*/
3595
__pyx_v_sign = 1;
3596
3597
/* "psage/modform/rational/modular_symbol_map.pyx":200
3598
*
3599
* # initialize answer vector to 0
3600
* for i in range(self.d): # <<<<<<<<<<<<<<
3601
* v[i] = 0
3602
*
3603
*/
3604
__pyx_t_1 = __pyx_v_self->d;
3605
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
3606
__pyx_v_i = __pyx_t_2;
3607
3608
/* "psage/modform/rational/modular_symbol_map.pyx":201
3609
* # initialize answer vector to 0
3610
* for i in range(self.d):
3611
* v[i] = 0 # <<<<<<<<<<<<<<
3612
*
3613
* # compute continued fraction
3614
*/
3615
(__pyx_v_v[__pyx_v_i]) = 0;
3616
}
3617
3618
/* "psage/modform/rational/modular_symbol_map.pyx":204
3619
*
3620
* # compute continued fraction
3621
* n = contfrac_q(q, a, b) # <<<<<<<<<<<<<<
3622
*
3623
* # compute corresponding modular symbols, mapping over...
3624
*/
3625
__pyx_t_1 = __pyx_f_5psage_7modform_8rational_18modular_symbol_map_contfrac_q(__pyx_v_q, __pyx_v_a, __pyx_v_b); if (unlikely(__pyx_t_1 == -1L)) __PYX_ERR(0, 204, __pyx_L1_error)
3626
__pyx_v_n = __pyx_t_1;
3627
3628
/* "psage/modform/rational/modular_symbol_map.pyx":207
3629
*
3630
* # compute corresponding modular symbols, mapping over...
3631
* for i in range(1,n): # <<<<<<<<<<<<<<
3632
* j = self.P1.index((sign*q[i])%self.N, q[i-1]%self.N)
3633
* # map over, adding a row of the matrix self.X
3634
*/
3635
__pyx_t_2 = __pyx_v_n;
3636
for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3637
__pyx_v_i = __pyx_t_3;
3638
3639
/* "psage/modform/rational/modular_symbol_map.pyx":208
3640
* # compute corresponding modular symbols, mapping over...
3641
* for i in range(1,n):
3642
* j = self.P1.index((sign*q[i])%self.N, q[i-1]%self.N) # <<<<<<<<<<<<<<
3643
* # map over, adding a row of the matrix self.X
3644
* # to the answer vector v.
3645
*/
3646
__pyx_t_1 = (__pyx_v_sign * (__pyx_v_q[__pyx_v_i]));
3647
if (unlikely(__pyx_v_self->N == 0)) {
3648
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
3649
__PYX_ERR(0, 208, __pyx_L1_error)
3650
}
3651
__pyx_t_4 = (__pyx_v_q[(__pyx_v_i - 1)]);
3652
if (unlikely(__pyx_v_self->N == 0)) {
3653
PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
3654
__PYX_ERR(0, 208, __pyx_L1_error)
3655
}
3656
__pyx_t_5 = ((struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_P1List *)__pyx_v_self->P1->__pyx_vtab)->index(__pyx_v_self->P1, __Pyx_mod_long(__pyx_t_1, __pyx_v_self->N), __Pyx_mod_long(__pyx_t_4, __pyx_v_self->N), 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error)
3657
__Pyx_GOTREF(__pyx_t_5);
3658
__pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error)
3659
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3660
__pyx_v_j = __pyx_t_6;
3661
3662
/* "psage/modform/rational/modular_symbol_map.pyx":211
3663
* # map over, adding a row of the matrix self.X
3664
* # to the answer vector v.
3665
* x = self.X + j*self.d # <<<<<<<<<<<<<<
3666
* for k in range(self.d):
3667
* v[k] += x[k]
3668
*/
3669
__pyx_v_x = (__pyx_v_self->X + (__pyx_v_j * __pyx_v_self->d));
3670
3671
/* "psage/modform/rational/modular_symbol_map.pyx":212
3672
* # to the answer vector v.
3673
* x = self.X + j*self.d
3674
* for k in range(self.d): # <<<<<<<<<<<<<<
3675
* v[k] += x[k]
3676
* # change sign, so q[i] is multiplied by (-1)^(i-1)
3677
*/
3678
__pyx_t_4 = __pyx_v_self->d;
3679
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_4; __pyx_t_6+=1) {
3680
__pyx_v_k = __pyx_t_6;
3681
3682
/* "psage/modform/rational/modular_symbol_map.pyx":213
3683
* x = self.X + j*self.d
3684
* for k in range(self.d):
3685
* v[k] += x[k] # <<<<<<<<<<<<<<
3686
* # change sign, so q[i] is multiplied by (-1)^(i-1)
3687
* sign *= -1
3688
*/
3689
__pyx_t_7 = __pyx_v_k;
3690
(__pyx_v_v[__pyx_t_7]) = ((__pyx_v_v[__pyx_t_7]) + (__pyx_v_x[__pyx_v_k]));
3691
}
3692
3693
/* "psage/modform/rational/modular_symbol_map.pyx":215
3694
* v[k] += x[k]
3695
* # change sign, so q[i] is multiplied by (-1)^(i-1)
3696
* sign *= -1 # <<<<<<<<<<<<<<
3697
*
3698
* def dimension(self):
3699
*/
3700
__pyx_v_sign = (__pyx_v_sign * -1L);
3701
}
3702
3703
/* "psage/modform/rational/modular_symbol_map.pyx":194
3704
* sage_free(self.X)
3705
*
3706
* cdef int evaluate(self, long v[MAX_DEG], long a, long b) except -1: # <<<<<<<<<<<<<<
3707
* cdef long q[MAX_CONTFRAC]
3708
* cdef int i, j, k, n, sign=1
3709
*/
3710
3711
/* function exit code */
3712
__pyx_r = 0;
3713
goto __pyx_L0;
3714
__pyx_L1_error:;
3715
__Pyx_XDECREF(__pyx_t_5);
3716
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
3717
__pyx_r = -1;
3718
__pyx_L0:;
3719
__Pyx_RefNannyFinishContext();
3720
return __pyx_r;
3721
}
3722
3723
/* "psage/modform/rational/modular_symbol_map.pyx":217
3724
* sign *= -1
3725
*
3726
* def dimension(self): # <<<<<<<<<<<<<<
3727
* return self.d
3728
*
3729
*/
3730
3731
/* Python wrapper */
3732
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_13dimension(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3733
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_12dimension[] = "File: modular_symbol_map.pyx (starting at line 217)";
3734
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_13dimension(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3735
PyObject *__pyx_r = 0;
3736
__Pyx_RefNannyDeclarations
3737
__Pyx_RefNannySetupContext("dimension (wrapper)", 0);
3738
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_12dimension(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
3739
3740
/* function exit code */
3741
__Pyx_RefNannyFinishContext();
3742
return __pyx_r;
3743
}
3744
3745
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_12dimension(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
3746
PyObject *__pyx_r = NULL;
3747
__Pyx_RefNannyDeclarations
3748
PyObject *__pyx_t_1 = NULL;
3749
__Pyx_RefNannySetupContext("dimension", 0);
3750
3751
/* "psage/modform/rational/modular_symbol_map.pyx":218
3752
*
3753
* def dimension(self):
3754
* return self.d # <<<<<<<<<<<<<<
3755
*
3756
* def _eval0(self, a, b):
3757
*/
3758
__Pyx_XDECREF(__pyx_r);
3759
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
3760
__Pyx_GOTREF(__pyx_t_1);
3761
__pyx_r = __pyx_t_1;
3762
__pyx_t_1 = 0;
3763
goto __pyx_L0;
3764
3765
/* "psage/modform/rational/modular_symbol_map.pyx":217
3766
* sign *= -1
3767
*
3768
* def dimension(self): # <<<<<<<<<<<<<<
3769
* return self.d
3770
*
3771
*/
3772
3773
/* function exit code */
3774
__pyx_L1_error:;
3775
__Pyx_XDECREF(__pyx_t_1);
3776
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.dimension", __pyx_clineno, __pyx_lineno, __pyx_filename);
3777
__pyx_r = NULL;
3778
__pyx_L0:;
3779
__Pyx_XGIVEREF(__pyx_r);
3780
__Pyx_RefNannyFinishContext();
3781
return __pyx_r;
3782
}
3783
3784
/* "psage/modform/rational/modular_symbol_map.pyx":220
3785
* return self.d
3786
*
3787
* def _eval0(self, a, b): # <<<<<<<<<<<<<<
3788
* cdef long v[MAX_DEG]
3789
* self.evaluate(v, a, b)
3790
*/
3791
3792
/* Python wrapper */
3793
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_15_eval0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3794
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_14_eval0[] = "File: modular_symbol_map.pyx (starting at line 220)";
3795
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_15_eval0(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3796
PyObject *__pyx_v_a = 0;
3797
PyObject *__pyx_v_b = 0;
3798
PyObject *__pyx_r = 0;
3799
__Pyx_RefNannyDeclarations
3800
__Pyx_RefNannySetupContext("_eval0 (wrapper)", 0);
3801
{
3802
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
3803
PyObject* values[2] = {0,0};
3804
if (unlikely(__pyx_kwds)) {
3805
Py_ssize_t kw_args;
3806
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3807
switch (pos_args) {
3808
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3809
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3810
case 0: break;
3811
default: goto __pyx_L5_argtuple_error;
3812
}
3813
kw_args = PyDict_Size(__pyx_kwds);
3814
switch (pos_args) {
3815
case 0:
3816
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
3817
else goto __pyx_L5_argtuple_error;
3818
case 1:
3819
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
3820
else {
3821
__Pyx_RaiseArgtupleInvalid("_eval0", 1, 2, 2, 1); __PYX_ERR(0, 220, __pyx_L3_error)
3822
}
3823
}
3824
if (unlikely(kw_args > 0)) {
3825
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_eval0") < 0)) __PYX_ERR(0, 220, __pyx_L3_error)
3826
}
3827
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3828
goto __pyx_L5_argtuple_error;
3829
} else {
3830
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3831
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3832
}
3833
__pyx_v_a = values[0];
3834
__pyx_v_b = values[1];
3835
}
3836
goto __pyx_L4_argument_unpacking_done;
3837
__pyx_L5_argtuple_error:;
3838
__Pyx_RaiseArgtupleInvalid("_eval0", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 220, __pyx_L3_error)
3839
__pyx_L3_error:;
3840
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap._eval0", __pyx_clineno, __pyx_lineno, __pyx_filename);
3841
__Pyx_RefNannyFinishContext();
3842
return NULL;
3843
__pyx_L4_argument_unpacking_done:;
3844
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_14_eval0(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), __pyx_v_a, __pyx_v_b);
3845
3846
/* function exit code */
3847
__Pyx_RefNannyFinishContext();
3848
return __pyx_r;
3849
}
3850
3851
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_14_eval0(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
3852
long __pyx_v_v[__pyx_e_5psage_7modform_8rational_18modular_symbol_map_MAX_DEG];
3853
PyObject *__pyx_r = NULL;
3854
__Pyx_RefNannyDeclarations
3855
long __pyx_t_1;
3856
long __pyx_t_2;
3857
int __pyx_t_3;
3858
__Pyx_RefNannySetupContext("_eval0", 0);
3859
3860
/* "psage/modform/rational/modular_symbol_map.pyx":222
3861
* def _eval0(self, a, b):
3862
* cdef long v[MAX_DEG]
3863
* self.evaluate(v, a, b) # <<<<<<<<<<<<<<
3864
*
3865
* def _eval1(self, a, b):
3866
*/
3867
__pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_a); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
3868
__pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_b); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L1_error)
3869
__pyx_t_3 = ((struct __pyx_vtabstruct_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self->__pyx_vtab)->evaluate(__pyx_v_self, __pyx_v_v, __pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 222, __pyx_L1_error)
3870
3871
/* "psage/modform/rational/modular_symbol_map.pyx":220
3872
* return self.d
3873
*
3874
* def _eval0(self, a, b): # <<<<<<<<<<<<<<
3875
* cdef long v[MAX_DEG]
3876
* self.evaluate(v, a, b)
3877
*/
3878
3879
/* function exit code */
3880
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3881
goto __pyx_L0;
3882
__pyx_L1_error:;
3883
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap._eval0", __pyx_clineno, __pyx_lineno, __pyx_filename);
3884
__pyx_r = NULL;
3885
__pyx_L0:;
3886
__Pyx_XGIVEREF(__pyx_r);
3887
__Pyx_RefNannyFinishContext();
3888
return __pyx_r;
3889
}
3890
3891
/* "psage/modform/rational/modular_symbol_map.pyx":224
3892
* self.evaluate(v, a, b)
3893
*
3894
* def _eval1(self, a, b): # <<<<<<<<<<<<<<
3895
* """
3896
* EXAMPLE::
3897
*/
3898
3899
/* Python wrapper */
3900
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_17_eval1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3901
static char __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_16_eval1[] = "File: modular_symbol_map.pyx (starting at line 224)\n\n EXAMPLE::\n\n sage: from psage.modform.rational.modular_symbol_map import ModularSymbolMap\n sage: A = ModularSymbols(188,sign=1).cuspidal_subspace().new_subspace().decomposition()[-1]\n sage: f = ModularSymbolMap(A)\n sage: f._eval1(-3,7)\n [-3, 0]\n\n ";
3902
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_17_eval1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3903
PyObject *__pyx_v_a = 0;
3904
PyObject *__pyx_v_b = 0;
3905
PyObject *__pyx_r = 0;
3906
__Pyx_RefNannyDeclarations
3907
__Pyx_RefNannySetupContext("_eval1 (wrapper)", 0);
3908
{
3909
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
3910
PyObject* values[2] = {0,0};
3911
if (unlikely(__pyx_kwds)) {
3912
Py_ssize_t kw_args;
3913
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3914
switch (pos_args) {
3915
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3916
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3917
case 0: break;
3918
default: goto __pyx_L5_argtuple_error;
3919
}
3920
kw_args = PyDict_Size(__pyx_kwds);
3921
switch (pos_args) {
3922
case 0:
3923
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
3924
else goto __pyx_L5_argtuple_error;
3925
case 1:
3926
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
3927
else {
3928
__Pyx_RaiseArgtupleInvalid("_eval1", 1, 2, 2, 1); __PYX_ERR(0, 224, __pyx_L3_error)
3929
}
3930
}
3931
if (unlikely(kw_args > 0)) {
3932
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_eval1") < 0)) __PYX_ERR(0, 224, __pyx_L3_error)
3933
}
3934
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3935
goto __pyx_L5_argtuple_error;
3936
} else {
3937
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3938
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3939
}
3940
__pyx_v_a = values[0];
3941
__pyx_v_b = values[1];
3942
}
3943
goto __pyx_L4_argument_unpacking_done;
3944
__pyx_L5_argtuple_error:;
3945
__Pyx_RaiseArgtupleInvalid("_eval1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 224, __pyx_L3_error)
3946
__pyx_L3_error:;
3947
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap._eval1", __pyx_clineno, __pyx_lineno, __pyx_filename);
3948
__Pyx_RefNannyFinishContext();
3949
return NULL;
3950
__pyx_L4_argument_unpacking_done:;
3951
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_16_eval1(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), __pyx_v_a, __pyx_v_b);
3952
3953
/* function exit code */
3954
__Pyx_RefNannyFinishContext();
3955
return __pyx_r;
3956
}
3957
3958
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_16_eval1(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
3959
long __pyx_v_v[__pyx_e_5psage_7modform_8rational_18modular_symbol_map_MAX_DEG];
3960
int __pyx_v_i;
3961
PyObject *__pyx_r = NULL;
3962
__Pyx_RefNannyDeclarations
3963
long __pyx_t_1;
3964
long __pyx_t_2;
3965
int __pyx_t_3;
3966
PyObject *__pyx_t_4 = NULL;
3967
PyObject *__pyx_t_5 = NULL;
3968
__Pyx_RefNannySetupContext("_eval1", 0);
3969
3970
/* "psage/modform/rational/modular_symbol_map.pyx":236
3971
* """
3972
* cdef long v[MAX_DEG]
3973
* self.evaluate(v, a, b) # <<<<<<<<<<<<<<
3974
* cdef int i
3975
* return [v[i] for i in range(self.d)]
3976
*/
3977
__pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_a); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error)
3978
__pyx_t_2 = __Pyx_PyInt_As_long(__pyx_v_b); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error)
3979
__pyx_t_3 = ((struct __pyx_vtabstruct_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self->__pyx_vtab)->evaluate(__pyx_v_self, __pyx_v_v, __pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 236, __pyx_L1_error)
3980
3981
/* "psage/modform/rational/modular_symbol_map.pyx":238
3982
* self.evaluate(v, a, b)
3983
* cdef int i
3984
* return [v[i] for i in range(self.d)] # <<<<<<<<<<<<<<
3985
*
3986
*
3987
*/
3988
__Pyx_XDECREF(__pyx_r);
3989
__pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
3990
__Pyx_GOTREF(__pyx_t_4);
3991
__pyx_t_2 = __pyx_v_self->d;
3992
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3993
__pyx_v_i = __pyx_t_3;
3994
__pyx_t_5 = __Pyx_PyInt_From_long((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error)
3995
__Pyx_GOTREF(__pyx_t_5);
3996
if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 238, __pyx_L1_error)
3997
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3998
}
3999
__pyx_r = __pyx_t_4;
4000
__pyx_t_4 = 0;
4001
goto __pyx_L0;
4002
4003
/* "psage/modform/rational/modular_symbol_map.pyx":224
4004
* self.evaluate(v, a, b)
4005
*
4006
* def _eval1(self, a, b): # <<<<<<<<<<<<<<
4007
* """
4008
* EXAMPLE::
4009
*/
4010
4011
/* function exit code */
4012
__pyx_L1_error:;
4013
__Pyx_XDECREF(__pyx_t_4);
4014
__Pyx_XDECREF(__pyx_t_5);
4015
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap._eval1", __pyx_clineno, __pyx_lineno, __pyx_filename);
4016
__pyx_r = NULL;
4017
__pyx_L0:;
4018
__Pyx_XGIVEREF(__pyx_r);
4019
__Pyx_RefNannyFinishContext();
4020
return __pyx_r;
4021
}
4022
4023
/* "psage/modform/rational/modular_symbol_map.pxd":30
4024
* cdef class ModularSymbolMap:
4025
* cdef long d, N
4026
* cdef public long denom # <<<<<<<<<<<<<<
4027
* cdef long* X # coefficients of linear map from P^1 to Q^d.
4028
* cdef public object C
4029
*/
4030
4031
/* Python wrapper */
4032
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_1__get__(PyObject *__pyx_v_self); /*proto*/
4033
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_1__get__(PyObject *__pyx_v_self) {
4034
PyObject *__pyx_r = 0;
4035
__Pyx_RefNannyDeclarations
4036
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4037
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom___get__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
4038
4039
/* function exit code */
4040
__Pyx_RefNannyFinishContext();
4041
return __pyx_r;
4042
}
4043
4044
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom___get__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
4045
PyObject *__pyx_r = NULL;
4046
__Pyx_RefNannyDeclarations
4047
PyObject *__pyx_t_1 = NULL;
4048
__Pyx_RefNannySetupContext("__get__", 0);
4049
__Pyx_XDECREF(__pyx_r);
4050
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_self->denom); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error)
4051
__Pyx_GOTREF(__pyx_t_1);
4052
__pyx_r = __pyx_t_1;
4053
__pyx_t_1 = 0;
4054
goto __pyx_L0;
4055
4056
/* function exit code */
4057
__pyx_L1_error:;
4058
__Pyx_XDECREF(__pyx_t_1);
4059
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.denom.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4060
__pyx_r = NULL;
4061
__pyx_L0:;
4062
__Pyx_XGIVEREF(__pyx_r);
4063
__Pyx_RefNannyFinishContext();
4064
return __pyx_r;
4065
}
4066
4067
/* Python wrapper */
4068
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
4069
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
4070
int __pyx_r;
4071
__Pyx_RefNannyDeclarations
4072
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
4073
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_2__set__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), ((PyObject *)__pyx_v_value));
4074
4075
/* function exit code */
4076
__Pyx_RefNannyFinishContext();
4077
return __pyx_r;
4078
}
4079
4080
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_2__set__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_value) {
4081
int __pyx_r;
4082
__Pyx_RefNannyDeclarations
4083
long __pyx_t_1;
4084
__Pyx_RefNannySetupContext("__set__", 0);
4085
__pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error)
4086
__pyx_v_self->denom = __pyx_t_1;
4087
4088
/* function exit code */
4089
__pyx_r = 0;
4090
goto __pyx_L0;
4091
__pyx_L1_error:;
4092
__Pyx_AddTraceback("psage.modform.rational.modular_symbol_map.ModularSymbolMap.denom.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4093
__pyx_r = -1;
4094
__pyx_L0:;
4095
__Pyx_RefNannyFinishContext();
4096
return __pyx_r;
4097
}
4098
4099
/* "psage/modform/rational/modular_symbol_map.pxd":32
4100
* cdef public long denom
4101
* cdef long* X # coefficients of linear map from P^1 to Q^d.
4102
* cdef public object C # <<<<<<<<<<<<<<
4103
* cdef P1List P1
4104
* cdef int evaluate(self, long v[MAX_DEG], long a, long b) except -1
4105
*/
4106
4107
/* Python wrapper */
4108
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_1__get__(PyObject *__pyx_v_self); /*proto*/
4109
static PyObject *__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_1__get__(PyObject *__pyx_v_self) {
4110
PyObject *__pyx_r = 0;
4111
__Pyx_RefNannyDeclarations
4112
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4113
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C___get__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
4114
4115
/* function exit code */
4116
__Pyx_RefNannyFinishContext();
4117
return __pyx_r;
4118
}
4119
4120
static PyObject *__pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C___get__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
4121
PyObject *__pyx_r = NULL;
4122
__Pyx_RefNannyDeclarations
4123
__Pyx_RefNannySetupContext("__get__", 0);
4124
__Pyx_XDECREF(__pyx_r);
4125
__Pyx_INCREF(__pyx_v_self->C);
4126
__pyx_r = __pyx_v_self->C;
4127
goto __pyx_L0;
4128
4129
/* function exit code */
4130
__pyx_L0:;
4131
__Pyx_XGIVEREF(__pyx_r);
4132
__Pyx_RefNannyFinishContext();
4133
return __pyx_r;
4134
}
4135
4136
/* Python wrapper */
4137
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
4138
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
4139
int __pyx_r;
4140
__Pyx_RefNannyDeclarations
4141
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
4142
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_2__set__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self), ((PyObject *)__pyx_v_value));
4143
4144
/* function exit code */
4145
__Pyx_RefNannyFinishContext();
4146
return __pyx_r;
4147
}
4148
4149
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_2__set__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self, PyObject *__pyx_v_value) {
4150
int __pyx_r;
4151
__Pyx_RefNannyDeclarations
4152
__Pyx_RefNannySetupContext("__set__", 0);
4153
__Pyx_INCREF(__pyx_v_value);
4154
__Pyx_GIVEREF(__pyx_v_value);
4155
__Pyx_GOTREF(__pyx_v_self->C);
4156
__Pyx_DECREF(__pyx_v_self->C);
4157
__pyx_v_self->C = __pyx_v_value;
4158
4159
/* function exit code */
4160
__pyx_r = 0;
4161
__Pyx_RefNannyFinishContext();
4162
return __pyx_r;
4163
}
4164
4165
/* Python wrapper */
4166
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_5__del__(PyObject *__pyx_v_self); /*proto*/
4167
static int __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_5__del__(PyObject *__pyx_v_self) {
4168
int __pyx_r;
4169
__Pyx_RefNannyDeclarations
4170
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
4171
__pyx_r = __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_4__del__(((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)__pyx_v_self));
4172
4173
/* function exit code */
4174
__Pyx_RefNannyFinishContext();
4175
return __pyx_r;
4176
}
4177
4178
static int __pyx_pf_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_4__del__(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *__pyx_v_self) {
4179
int __pyx_r;
4180
__Pyx_RefNannyDeclarations
4181
__Pyx_RefNannySetupContext("__del__", 0);
4182
__Pyx_INCREF(Py_None);
4183
__Pyx_GIVEREF(Py_None);
4184
__Pyx_GOTREF(__pyx_v_self->C);
4185
__Pyx_DECREF(__pyx_v_self->C);
4186
__pyx_v_self->C = Py_None;
4187
4188
/* function exit code */
4189
__pyx_r = 0;
4190
__Pyx_RefNannyFinishContext();
4191
return __pyx_r;
4192
}
4193
4194
/* "cysignals/memory.pxd":40
4195
*
4196
*
4197
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
4198
* sig_block()
4199
* cdef void* ret = malloc(n)
4200
*/
4201
4202
static CYTHON_INLINE void *sig_malloc(size_t __pyx_v_n) {
4203
void *__pyx_v_ret;
4204
void *__pyx_r;
4205
4206
/* "cysignals/memory.pxd":41
4207
*
4208
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
4209
* sig_block() # <<<<<<<<<<<<<<
4210
* cdef void* ret = malloc(n)
4211
* sig_unblock()
4212
*/
4213
sig_block();
4214
4215
/* "cysignals/memory.pxd":42
4216
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
4217
* sig_block()
4218
* cdef void* ret = malloc(n) # <<<<<<<<<<<<<<
4219
* sig_unblock()
4220
* return ret
4221
*/
4222
__pyx_v_ret = malloc(__pyx_v_n);
4223
4224
/* "cysignals/memory.pxd":43
4225
* sig_block()
4226
* cdef void* ret = malloc(n)
4227
* sig_unblock() # <<<<<<<<<<<<<<
4228
* return ret
4229
*
4230
*/
4231
sig_unblock();
4232
4233
/* "cysignals/memory.pxd":44
4234
* cdef void* ret = malloc(n)
4235
* sig_unblock()
4236
* return ret # <<<<<<<<<<<<<<
4237
*
4238
*
4239
*/
4240
__pyx_r = __pyx_v_ret;
4241
goto __pyx_L0;
4242
4243
/* "cysignals/memory.pxd":40
4244
*
4245
*
4246
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
4247
* sig_block()
4248
* cdef void* ret = malloc(n)
4249
*/
4250
4251
/* function exit code */
4252
__pyx_L0:;
4253
return __pyx_r;
4254
}
4255
4256
/* "cysignals/memory.pxd":47
4257
*
4258
*
4259
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
4260
* sig_block()
4261
* cdef void* ret = realloc(ptr, size)
4262
*/
4263
4264
static CYTHON_INLINE void *sig_realloc(void *__pyx_v_ptr, size_t __pyx_v_size) {
4265
void *__pyx_v_ret;
4266
void *__pyx_r;
4267
4268
/* "cysignals/memory.pxd":48
4269
*
4270
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
4271
* sig_block() # <<<<<<<<<<<<<<
4272
* cdef void* ret = realloc(ptr, size)
4273
* sig_unblock()
4274
*/
4275
sig_block();
4276
4277
/* "cysignals/memory.pxd":49
4278
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
4279
* sig_block()
4280
* cdef void* ret = realloc(ptr, size) # <<<<<<<<<<<<<<
4281
* sig_unblock()
4282
* return ret
4283
*/
4284
__pyx_v_ret = realloc(__pyx_v_ptr, __pyx_v_size);
4285
4286
/* "cysignals/memory.pxd":50
4287
* sig_block()
4288
* cdef void* ret = realloc(ptr, size)
4289
* sig_unblock() # <<<<<<<<<<<<<<
4290
* return ret
4291
*
4292
*/
4293
sig_unblock();
4294
4295
/* "cysignals/memory.pxd":51
4296
* cdef void* ret = realloc(ptr, size)
4297
* sig_unblock()
4298
* return ret # <<<<<<<<<<<<<<
4299
*
4300
*
4301
*/
4302
__pyx_r = __pyx_v_ret;
4303
goto __pyx_L0;
4304
4305
/* "cysignals/memory.pxd":47
4306
*
4307
*
4308
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
4309
* sig_block()
4310
* cdef void* ret = realloc(ptr, size)
4311
*/
4312
4313
/* function exit code */
4314
__pyx_L0:;
4315
return __pyx_r;
4316
}
4317
4318
/* "cysignals/memory.pxd":54
4319
*
4320
*
4321
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
4322
* sig_block()
4323
* cdef void* ret = calloc(nmemb, size)
4324
*/
4325
4326
static CYTHON_INLINE void *sig_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
4327
void *__pyx_v_ret;
4328
void *__pyx_r;
4329
4330
/* "cysignals/memory.pxd":55
4331
*
4332
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
4333
* sig_block() # <<<<<<<<<<<<<<
4334
* cdef void* ret = calloc(nmemb, size)
4335
* sig_unblock()
4336
*/
4337
sig_block();
4338
4339
/* "cysignals/memory.pxd":56
4340
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
4341
* sig_block()
4342
* cdef void* ret = calloc(nmemb, size) # <<<<<<<<<<<<<<
4343
* sig_unblock()
4344
* return ret
4345
*/
4346
__pyx_v_ret = calloc(__pyx_v_nmemb, __pyx_v_size);
4347
4348
/* "cysignals/memory.pxd":57
4349
* sig_block()
4350
* cdef void* ret = calloc(nmemb, size)
4351
* sig_unblock() # <<<<<<<<<<<<<<
4352
* return ret
4353
*
4354
*/
4355
sig_unblock();
4356
4357
/* "cysignals/memory.pxd":58
4358
* cdef void* ret = calloc(nmemb, size)
4359
* sig_unblock()
4360
* return ret # <<<<<<<<<<<<<<
4361
*
4362
*
4363
*/
4364
__pyx_r = __pyx_v_ret;
4365
goto __pyx_L0;
4366
4367
/* "cysignals/memory.pxd":54
4368
*
4369
*
4370
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
4371
* sig_block()
4372
* cdef void* ret = calloc(nmemb, size)
4373
*/
4374
4375
/* function exit code */
4376
__pyx_L0:;
4377
return __pyx_r;
4378
}
4379
4380
/* "cysignals/memory.pxd":61
4381
*
4382
*
4383
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
4384
* sig_block()
4385
* free(ptr)
4386
*/
4387
4388
static CYTHON_INLINE void sig_free(void *__pyx_v_ptr) {
4389
4390
/* "cysignals/memory.pxd":62
4391
*
4392
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
4393
* sig_block() # <<<<<<<<<<<<<<
4394
* free(ptr)
4395
* sig_unblock()
4396
*/
4397
sig_block();
4398
4399
/* "cysignals/memory.pxd":63
4400
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
4401
* sig_block()
4402
* free(ptr) # <<<<<<<<<<<<<<
4403
* sig_unblock()
4404
*
4405
*/
4406
free(__pyx_v_ptr);
4407
4408
/* "cysignals/memory.pxd":64
4409
* sig_block()
4410
* free(ptr)
4411
* sig_unblock() # <<<<<<<<<<<<<<
4412
*
4413
*
4414
*/
4415
sig_unblock();
4416
4417
/* "cysignals/memory.pxd":61
4418
*
4419
*
4420
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
4421
* sig_block()
4422
* free(ptr)
4423
*/
4424
4425
/* function exit code */
4426
}
4427
4428
/* "cysignals/memory.pxd":68
4429
*
4430
* @cython.cdivision(True)
4431
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
4432
* """
4433
* Return a*b, checking for overflow. Assume that a > 0.
4434
*/
4435
4436
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t __pyx_v_a, size_t __pyx_v_b) {
4437
size_t __pyx_v_MUL_NO_OVERFLOW;
4438
size_t __pyx_r;
4439
int __pyx_t_1;
4440
int __pyx_t_2;
4441
4442
/* "cysignals/memory.pxd":75
4443
* """
4444
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
4445
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t))) # <<<<<<<<<<<<<<
4446
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4447
* if unlikely(b > (<size_t>-1) // a):
4448
*/
4449
__pyx_v_MUL_NO_OVERFLOW = (((size_t)1) << (4 * (sizeof(size_t))));
4450
4451
/* "cysignals/memory.pxd":76
4452
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
4453
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4454
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
4455
* if unlikely(b > (<size_t>-1) // a):
4456
* return <size_t>(-1)
4457
*/
4458
__pyx_t_2 = ((__pyx_v_a >= __pyx_v_MUL_NO_OVERFLOW) != 0);
4459
if (!__pyx_t_2) {
4460
} else {
4461
__pyx_t_1 = __pyx_t_2;
4462
goto __pyx_L4_bool_binop_done;
4463
}
4464
__pyx_t_2 = ((__pyx_v_b >= __pyx_v_MUL_NO_OVERFLOW) != 0);
4465
__pyx_t_1 = __pyx_t_2;
4466
__pyx_L4_bool_binop_done:;
4467
if (__pyx_t_1) {
4468
4469
/* "cysignals/memory.pxd":77
4470
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4471
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4472
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
4473
* return <size_t>(-1)
4474
* return a*b
4475
*/
4476
__pyx_t_1 = (unlikely((__pyx_v_b > (((size_t)-1L) / __pyx_v_a))) != 0);
4477
if (__pyx_t_1) {
4478
4479
/* "cysignals/memory.pxd":78
4480
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4481
* if unlikely(b > (<size_t>-1) // a):
4482
* return <size_t>(-1) # <<<<<<<<<<<<<<
4483
* return a*b
4484
*
4485
*/
4486
__pyx_r = ((size_t)-1L);
4487
goto __pyx_L0;
4488
4489
/* "cysignals/memory.pxd":77
4490
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4491
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4492
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
4493
* return <size_t>(-1)
4494
* return a*b
4495
*/
4496
}
4497
4498
/* "cysignals/memory.pxd":76
4499
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
4500
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4501
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
4502
* if unlikely(b > (<size_t>-1) // a):
4503
* return <size_t>(-1)
4504
*/
4505
}
4506
4507
/* "cysignals/memory.pxd":79
4508
* if unlikely(b > (<size_t>-1) // a):
4509
* return <size_t>(-1)
4510
* return a*b # <<<<<<<<<<<<<<
4511
*
4512
*
4513
*/
4514
__pyx_r = (__pyx_v_a * __pyx_v_b);
4515
goto __pyx_L0;
4516
4517
/* "cysignals/memory.pxd":68
4518
*
4519
* @cython.cdivision(True)
4520
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
4521
* """
4522
* Return a*b, checking for overflow. Assume that a > 0.
4523
*/
4524
4525
/* function exit code */
4526
__pyx_L0:;
4527
return __pyx_r;
4528
}
4529
4530
/* "cysignals/memory.pxd":82
4531
*
4532
*
4533
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4534
* """
4535
* Allocate memory for ``nmemb`` elements of size ``size``.
4536
*/
4537
4538
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
4539
size_t __pyx_v_n;
4540
void *__pyx_v_ret;
4541
void *__pyx_r;
4542
__Pyx_RefNannyDeclarations
4543
int __pyx_t_1;
4544
PyObject *__pyx_t_2 = NULL;
4545
PyObject *__pyx_t_3 = NULL;
4546
PyObject *__pyx_t_4 = NULL;
4547
__Pyx_RefNannySetupContext("check_allocarray", 0);
4548
4549
/* "cysignals/memory.pxd":86
4550
* Allocate memory for ``nmemb`` elements of size ``size``.
4551
* """
4552
* if nmemb == 0: # <<<<<<<<<<<<<<
4553
* return NULL
4554
* cdef size_t n = mul_overflowcheck(nmemb, size)
4555
*/
4556
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
4557
if (__pyx_t_1) {
4558
4559
/* "cysignals/memory.pxd":87
4560
* """
4561
* if nmemb == 0:
4562
* return NULL # <<<<<<<<<<<<<<
4563
* cdef size_t n = mul_overflowcheck(nmemb, size)
4564
* cdef void* ret = sig_malloc(n)
4565
*/
4566
__pyx_r = NULL;
4567
goto __pyx_L0;
4568
4569
/* "cysignals/memory.pxd":86
4570
* Allocate memory for ``nmemb`` elements of size ``size``.
4571
* """
4572
* if nmemb == 0: # <<<<<<<<<<<<<<
4573
* return NULL
4574
* cdef size_t n = mul_overflowcheck(nmemb, size)
4575
*/
4576
}
4577
4578
/* "cysignals/memory.pxd":88
4579
* if nmemb == 0:
4580
* return NULL
4581
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
4582
* cdef void* ret = sig_malloc(n)
4583
* if unlikely(ret == NULL):
4584
*/
4585
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
4586
4587
/* "cysignals/memory.pxd":89
4588
* return NULL
4589
* cdef size_t n = mul_overflowcheck(nmemb, size)
4590
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
4591
* if unlikely(ret == NULL):
4592
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4593
*/
4594
__pyx_v_ret = sig_malloc(__pyx_v_n);
4595
4596
/* "cysignals/memory.pxd":90
4597
* cdef size_t n = mul_overflowcheck(nmemb, size)
4598
* cdef void* ret = sig_malloc(n)
4599
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4600
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4601
* return ret
4602
*/
4603
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
4604
if (__pyx_t_1) {
4605
4606
/* "cysignals/memory.pxd":91
4607
* cdef void* ret = sig_malloc(n)
4608
* if unlikely(ret == NULL):
4609
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
4610
* return ret
4611
*
4612
*/
4613
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 91, __pyx_L1_error)
4614
__Pyx_GOTREF(__pyx_t_2);
4615
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
4616
__Pyx_GOTREF(__pyx_t_3);
4617
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 91, __pyx_L1_error)
4618
__Pyx_GOTREF(__pyx_t_4);
4619
__Pyx_GIVEREF(__pyx_t_2);
4620
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
4621
__Pyx_GIVEREF(__pyx_t_3);
4622
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
4623
__pyx_t_2 = 0;
4624
__pyx_t_3 = 0;
4625
__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(2, 91, __pyx_L1_error)
4626
__Pyx_GOTREF(__pyx_t_3);
4627
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4628
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 91, __pyx_L1_error)
4629
__Pyx_GOTREF(__pyx_t_4);
4630
__Pyx_GIVEREF(__pyx_t_3);
4631
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
4632
__pyx_t_3 = 0;
4633
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
4634
__Pyx_GOTREF(__pyx_t_3);
4635
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4636
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
4637
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4638
__PYX_ERR(2, 91, __pyx_L1_error)
4639
4640
/* "cysignals/memory.pxd":90
4641
* cdef size_t n = mul_overflowcheck(nmemb, size)
4642
* cdef void* ret = sig_malloc(n)
4643
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4644
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4645
* return ret
4646
*/
4647
}
4648
4649
/* "cysignals/memory.pxd":92
4650
* if unlikely(ret == NULL):
4651
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4652
* return ret # <<<<<<<<<<<<<<
4653
*
4654
*
4655
*/
4656
__pyx_r = __pyx_v_ret;
4657
goto __pyx_L0;
4658
4659
/* "cysignals/memory.pxd":82
4660
*
4661
*
4662
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4663
* """
4664
* Allocate memory for ``nmemb`` elements of size ``size``.
4665
*/
4666
4667
/* function exit code */
4668
__pyx_L1_error:;
4669
__Pyx_XDECREF(__pyx_t_2);
4670
__Pyx_XDECREF(__pyx_t_3);
4671
__Pyx_XDECREF(__pyx_t_4);
4672
__Pyx_AddTraceback("cysignals.memory.check_allocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
4673
__pyx_r = NULL;
4674
__pyx_L0:;
4675
__Pyx_RefNannyFinishContext();
4676
return __pyx_r;
4677
}
4678
4679
/* "cysignals/memory.pxd":95
4680
*
4681
*
4682
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4683
* """
4684
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
4685
*/
4686
4687
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *__pyx_v_ptr, size_t __pyx_v_nmemb, size_t __pyx_v_size) {
4688
size_t __pyx_v_n;
4689
void *__pyx_v_ret;
4690
void *__pyx_r;
4691
__Pyx_RefNannyDeclarations
4692
int __pyx_t_1;
4693
PyObject *__pyx_t_2 = NULL;
4694
PyObject *__pyx_t_3 = NULL;
4695
PyObject *__pyx_t_4 = NULL;
4696
__Pyx_RefNannySetupContext("check_reallocarray", 0);
4697
4698
/* "cysignals/memory.pxd":103
4699
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
4700
* """
4701
* if nmemb == 0: # <<<<<<<<<<<<<<
4702
* sig_free(ptr)
4703
* return NULL
4704
*/
4705
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
4706
if (__pyx_t_1) {
4707
4708
/* "cysignals/memory.pxd":104
4709
* """
4710
* if nmemb == 0:
4711
* sig_free(ptr) # <<<<<<<<<<<<<<
4712
* return NULL
4713
* cdef size_t n = mul_overflowcheck(nmemb, size)
4714
*/
4715
sig_free(__pyx_v_ptr);
4716
4717
/* "cysignals/memory.pxd":105
4718
* if nmemb == 0:
4719
* sig_free(ptr)
4720
* return NULL # <<<<<<<<<<<<<<
4721
* cdef size_t n = mul_overflowcheck(nmemb, size)
4722
* cdef void* ret = sig_realloc(ptr, n)
4723
*/
4724
__pyx_r = NULL;
4725
goto __pyx_L0;
4726
4727
/* "cysignals/memory.pxd":103
4728
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
4729
* """
4730
* if nmemb == 0: # <<<<<<<<<<<<<<
4731
* sig_free(ptr)
4732
* return NULL
4733
*/
4734
}
4735
4736
/* "cysignals/memory.pxd":106
4737
* sig_free(ptr)
4738
* return NULL
4739
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
4740
* cdef void* ret = sig_realloc(ptr, n)
4741
* if unlikely(ret == NULL):
4742
*/
4743
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
4744
4745
/* "cysignals/memory.pxd":107
4746
* return NULL
4747
* cdef size_t n = mul_overflowcheck(nmemb, size)
4748
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
4749
* if unlikely(ret == NULL):
4750
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4751
*/
4752
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
4753
4754
/* "cysignals/memory.pxd":108
4755
* cdef size_t n = mul_overflowcheck(nmemb, size)
4756
* cdef void* ret = sig_realloc(ptr, n)
4757
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4758
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4759
* return ret
4760
*/
4761
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
4762
if (__pyx_t_1) {
4763
4764
/* "cysignals/memory.pxd":109
4765
* cdef void* ret = sig_realloc(ptr, n)
4766
* if unlikely(ret == NULL):
4767
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
4768
* return ret
4769
*
4770
*/
4771
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 109, __pyx_L1_error)
4772
__Pyx_GOTREF(__pyx_t_2);
4773
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 109, __pyx_L1_error)
4774
__Pyx_GOTREF(__pyx_t_3);
4775
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 109, __pyx_L1_error)
4776
__Pyx_GOTREF(__pyx_t_4);
4777
__Pyx_GIVEREF(__pyx_t_2);
4778
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
4779
__Pyx_GIVEREF(__pyx_t_3);
4780
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
4781
__pyx_t_2 = 0;
4782
__pyx_t_3 = 0;
4783
__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(2, 109, __pyx_L1_error)
4784
__Pyx_GOTREF(__pyx_t_3);
4785
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4786
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 109, __pyx_L1_error)
4787
__Pyx_GOTREF(__pyx_t_4);
4788
__Pyx_GIVEREF(__pyx_t_3);
4789
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
4790
__pyx_t_3 = 0;
4791
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 109, __pyx_L1_error)
4792
__Pyx_GOTREF(__pyx_t_3);
4793
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4794
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
4795
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4796
__PYX_ERR(2, 109, __pyx_L1_error)
4797
4798
/* "cysignals/memory.pxd":108
4799
* cdef size_t n = mul_overflowcheck(nmemb, size)
4800
* cdef void* ret = sig_realloc(ptr, n)
4801
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4802
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4803
* return ret
4804
*/
4805
}
4806
4807
/* "cysignals/memory.pxd":110
4808
* if unlikely(ret == NULL):
4809
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4810
* return ret # <<<<<<<<<<<<<<
4811
*
4812
*
4813
*/
4814
__pyx_r = __pyx_v_ret;
4815
goto __pyx_L0;
4816
4817
/* "cysignals/memory.pxd":95
4818
*
4819
*
4820
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4821
* """
4822
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
4823
*/
4824
4825
/* function exit code */
4826
__pyx_L1_error:;
4827
__Pyx_XDECREF(__pyx_t_2);
4828
__Pyx_XDECREF(__pyx_t_3);
4829
__Pyx_XDECREF(__pyx_t_4);
4830
__Pyx_AddTraceback("cysignals.memory.check_reallocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
4831
__pyx_r = NULL;
4832
__pyx_L0:;
4833
__Pyx_RefNannyFinishContext();
4834
return __pyx_r;
4835
}
4836
4837
/* "cysignals/memory.pxd":113
4838
*
4839
*
4840
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
4841
* """
4842
* Allocate ``n`` bytes of memory.
4843
*/
4844
4845
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t __pyx_v_n) {
4846
void *__pyx_v_ret;
4847
void *__pyx_r;
4848
__Pyx_RefNannyDeclarations
4849
int __pyx_t_1;
4850
PyObject *__pyx_t_2 = NULL;
4851
PyObject *__pyx_t_3 = NULL;
4852
__Pyx_RefNannySetupContext("check_malloc", 0);
4853
4854
/* "cysignals/memory.pxd":117
4855
* Allocate ``n`` bytes of memory.
4856
* """
4857
* if n == 0: # <<<<<<<<<<<<<<
4858
* return NULL
4859
* cdef void* ret = sig_malloc(n)
4860
*/
4861
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
4862
if (__pyx_t_1) {
4863
4864
/* "cysignals/memory.pxd":118
4865
* """
4866
* if n == 0:
4867
* return NULL # <<<<<<<<<<<<<<
4868
* cdef void* ret = sig_malloc(n)
4869
* if unlikely(ret == NULL):
4870
*/
4871
__pyx_r = NULL;
4872
goto __pyx_L0;
4873
4874
/* "cysignals/memory.pxd":117
4875
* Allocate ``n`` bytes of memory.
4876
* """
4877
* if n == 0: # <<<<<<<<<<<<<<
4878
* return NULL
4879
* cdef void* ret = sig_malloc(n)
4880
*/
4881
}
4882
4883
/* "cysignals/memory.pxd":119
4884
* if n == 0:
4885
* return NULL
4886
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
4887
* if unlikely(ret == NULL):
4888
* raise MemoryError("failed to allocate %s bytes" % n)
4889
*/
4890
__pyx_v_ret = sig_malloc(__pyx_v_n);
4891
4892
/* "cysignals/memory.pxd":120
4893
* return NULL
4894
* cdef void* ret = sig_malloc(n)
4895
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4896
* raise MemoryError("failed to allocate %s bytes" % n)
4897
* return ret
4898
*/
4899
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
4900
if (__pyx_t_1) {
4901
4902
/* "cysignals/memory.pxd":121
4903
* cdef void* ret = sig_malloc(n)
4904
* if unlikely(ret == NULL):
4905
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
4906
* return ret
4907
*
4908
*/
4909
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 121, __pyx_L1_error)
4910
__Pyx_GOTREF(__pyx_t_2);
4911
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 121, __pyx_L1_error)
4912
__Pyx_GOTREF(__pyx_t_3);
4913
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4914
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 121, __pyx_L1_error)
4915
__Pyx_GOTREF(__pyx_t_2);
4916
__Pyx_GIVEREF(__pyx_t_3);
4917
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
4918
__pyx_t_3 = 0;
4919
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 121, __pyx_L1_error)
4920
__Pyx_GOTREF(__pyx_t_3);
4921
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4922
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
4923
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4924
__PYX_ERR(2, 121, __pyx_L1_error)
4925
4926
/* "cysignals/memory.pxd":120
4927
* return NULL
4928
* cdef void* ret = sig_malloc(n)
4929
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4930
* raise MemoryError("failed to allocate %s bytes" % n)
4931
* return ret
4932
*/
4933
}
4934
4935
/* "cysignals/memory.pxd":122
4936
* if unlikely(ret == NULL):
4937
* raise MemoryError("failed to allocate %s bytes" % n)
4938
* return ret # <<<<<<<<<<<<<<
4939
*
4940
*
4941
*/
4942
__pyx_r = __pyx_v_ret;
4943
goto __pyx_L0;
4944
4945
/* "cysignals/memory.pxd":113
4946
*
4947
*
4948
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
4949
* """
4950
* Allocate ``n`` bytes of memory.
4951
*/
4952
4953
/* function exit code */
4954
__pyx_L1_error:;
4955
__Pyx_XDECREF(__pyx_t_2);
4956
__Pyx_XDECREF(__pyx_t_3);
4957
__Pyx_AddTraceback("cysignals.memory.check_malloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4958
__pyx_r = NULL;
4959
__pyx_L0:;
4960
__Pyx_RefNannyFinishContext();
4961
return __pyx_r;
4962
}
4963
4964
/* "cysignals/memory.pxd":125
4965
*
4966
*
4967
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
4968
* """
4969
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
4970
*/
4971
4972
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *__pyx_v_ptr, size_t __pyx_v_n) {
4973
void *__pyx_v_ret;
4974
void *__pyx_r;
4975
__Pyx_RefNannyDeclarations
4976
int __pyx_t_1;
4977
PyObject *__pyx_t_2 = NULL;
4978
PyObject *__pyx_t_3 = NULL;
4979
__Pyx_RefNannySetupContext("check_realloc", 0);
4980
4981
/* "cysignals/memory.pxd":130
4982
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
4983
* """
4984
* if n == 0: # <<<<<<<<<<<<<<
4985
* sig_free(ptr)
4986
* return NULL
4987
*/
4988
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
4989
if (__pyx_t_1) {
4990
4991
/* "cysignals/memory.pxd":131
4992
* """
4993
* if n == 0:
4994
* sig_free(ptr) # <<<<<<<<<<<<<<
4995
* return NULL
4996
* cdef void* ret = sig_realloc(ptr, n)
4997
*/
4998
sig_free(__pyx_v_ptr);
4999
5000
/* "cysignals/memory.pxd":132
5001
* if n == 0:
5002
* sig_free(ptr)
5003
* return NULL # <<<<<<<<<<<<<<
5004
* cdef void* ret = sig_realloc(ptr, n)
5005
* if unlikely(ret == NULL):
5006
*/
5007
__pyx_r = NULL;
5008
goto __pyx_L0;
5009
5010
/* "cysignals/memory.pxd":130
5011
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
5012
* """
5013
* if n == 0: # <<<<<<<<<<<<<<
5014
* sig_free(ptr)
5015
* return NULL
5016
*/
5017
}
5018
5019
/* "cysignals/memory.pxd":133
5020
* sig_free(ptr)
5021
* return NULL
5022
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
5023
* if unlikely(ret == NULL):
5024
* raise MemoryError("failed to allocate %s bytes" % n)
5025
*/
5026
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
5027
5028
/* "cysignals/memory.pxd":134
5029
* return NULL
5030
* cdef void* ret = sig_realloc(ptr, n)
5031
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5032
* raise MemoryError("failed to allocate %s bytes" % n)
5033
* return ret
5034
*/
5035
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
5036
if (__pyx_t_1) {
5037
5038
/* "cysignals/memory.pxd":135
5039
* cdef void* ret = sig_realloc(ptr, n)
5040
* if unlikely(ret == NULL):
5041
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
5042
* return ret
5043
*
5044
*/
5045
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
5046
__Pyx_GOTREF(__pyx_t_2);
5047
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error)
5048
__Pyx_GOTREF(__pyx_t_3);
5049
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5050
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
5051
__Pyx_GOTREF(__pyx_t_2);
5052
__Pyx_GIVEREF(__pyx_t_3);
5053
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
5054
__pyx_t_3 = 0;
5055
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error)
5056
__Pyx_GOTREF(__pyx_t_3);
5057
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5058
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5059
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5060
__PYX_ERR(2, 135, __pyx_L1_error)
5061
5062
/* "cysignals/memory.pxd":134
5063
* return NULL
5064
* cdef void* ret = sig_realloc(ptr, n)
5065
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5066
* raise MemoryError("failed to allocate %s bytes" % n)
5067
* return ret
5068
*/
5069
}
5070
5071
/* "cysignals/memory.pxd":136
5072
* if unlikely(ret == NULL):
5073
* raise MemoryError("failed to allocate %s bytes" % n)
5074
* return ret # <<<<<<<<<<<<<<
5075
*
5076
*
5077
*/
5078
__pyx_r = __pyx_v_ret;
5079
goto __pyx_L0;
5080
5081
/* "cysignals/memory.pxd":125
5082
*
5083
*
5084
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
5085
* """
5086
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
5087
*/
5088
5089
/* function exit code */
5090
__pyx_L1_error:;
5091
__Pyx_XDECREF(__pyx_t_2);
5092
__Pyx_XDECREF(__pyx_t_3);
5093
__Pyx_AddTraceback("cysignals.memory.check_realloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5094
__pyx_r = NULL;
5095
__pyx_L0:;
5096
__Pyx_RefNannyFinishContext();
5097
return __pyx_r;
5098
}
5099
5100
/* "cysignals/memory.pxd":139
5101
*
5102
*
5103
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5104
* """
5105
* Allocate memory for ``nmemb`` elements of size ``size``. The
5106
*/
5107
5108
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
5109
void *__pyx_v_ret;
5110
void *__pyx_r;
5111
__Pyx_RefNannyDeclarations
5112
int __pyx_t_1;
5113
PyObject *__pyx_t_2 = NULL;
5114
PyObject *__pyx_t_3 = NULL;
5115
PyObject *__pyx_t_4 = NULL;
5116
__Pyx_RefNannySetupContext("check_calloc", 0);
5117
5118
/* "cysignals/memory.pxd":144
5119
* resulting memory is zeroed.
5120
* """
5121
* if nmemb == 0: # <<<<<<<<<<<<<<
5122
* return NULL
5123
* cdef void* ret = sig_calloc(nmemb, size)
5124
*/
5125
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
5126
if (__pyx_t_1) {
5127
5128
/* "cysignals/memory.pxd":145
5129
* """
5130
* if nmemb == 0:
5131
* return NULL # <<<<<<<<<<<<<<
5132
* cdef void* ret = sig_calloc(nmemb, size)
5133
* if unlikely(ret == NULL):
5134
*/
5135
__pyx_r = NULL;
5136
goto __pyx_L0;
5137
5138
/* "cysignals/memory.pxd":144
5139
* resulting memory is zeroed.
5140
* """
5141
* if nmemb == 0: # <<<<<<<<<<<<<<
5142
* return NULL
5143
* cdef void* ret = sig_calloc(nmemb, size)
5144
*/
5145
}
5146
5147
/* "cysignals/memory.pxd":146
5148
* if nmemb == 0:
5149
* return NULL
5150
* cdef void* ret = sig_calloc(nmemb, size) # <<<<<<<<<<<<<<
5151
* if unlikely(ret == NULL):
5152
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5153
*/
5154
__pyx_v_ret = sig_calloc(__pyx_v_nmemb, __pyx_v_size);
5155
5156
/* "cysignals/memory.pxd":147
5157
* return NULL
5158
* cdef void* ret = sig_calloc(nmemb, size)
5159
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5160
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5161
* return ret
5162
*/
5163
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
5164
if (__pyx_t_1) {
5165
5166
/* "cysignals/memory.pxd":148
5167
* cdef void* ret = sig_calloc(nmemb, size)
5168
* if unlikely(ret == NULL):
5169
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
5170
* return ret
5171
*/
5172
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 148, __pyx_L1_error)
5173
__Pyx_GOTREF(__pyx_t_2);
5174
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
5175
__Pyx_GOTREF(__pyx_t_3);
5176
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 148, __pyx_L1_error)
5177
__Pyx_GOTREF(__pyx_t_4);
5178
__Pyx_GIVEREF(__pyx_t_2);
5179
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
5180
__Pyx_GIVEREF(__pyx_t_3);
5181
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
5182
__pyx_t_2 = 0;
5183
__pyx_t_3 = 0;
5184
__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(2, 148, __pyx_L1_error)
5185
__Pyx_GOTREF(__pyx_t_3);
5186
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5187
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 148, __pyx_L1_error)
5188
__Pyx_GOTREF(__pyx_t_4);
5189
__Pyx_GIVEREF(__pyx_t_3);
5190
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
5191
__pyx_t_3 = 0;
5192
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
5193
__Pyx_GOTREF(__pyx_t_3);
5194
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5195
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5196
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5197
__PYX_ERR(2, 148, __pyx_L1_error)
5198
5199
/* "cysignals/memory.pxd":147
5200
* return NULL
5201
* cdef void* ret = sig_calloc(nmemb, size)
5202
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5203
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5204
* return ret
5205
*/
5206
}
5207
5208
/* "cysignals/memory.pxd":149
5209
* if unlikely(ret == NULL):
5210
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5211
* return ret # <<<<<<<<<<<<<<
5212
*/
5213
__pyx_r = __pyx_v_ret;
5214
goto __pyx_L0;
5215
5216
/* "cysignals/memory.pxd":139
5217
*
5218
*
5219
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5220
* """
5221
* Allocate memory for ``nmemb`` elements of size ``size``. The
5222
*/
5223
5224
/* function exit code */
5225
__pyx_L1_error:;
5226
__Pyx_XDECREF(__pyx_t_2);
5227
__Pyx_XDECREF(__pyx_t_3);
5228
__Pyx_XDECREF(__pyx_t_4);
5229
__Pyx_AddTraceback("cysignals.memory.check_calloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5230
__pyx_r = NULL;
5231
__pyx_L0:;
5232
__Pyx_RefNannyFinishContext();
5233
return __pyx_r;
5234
}
5235
5236
/* "sage/ext/stdsage.pxd":16
5237
*
5238
*
5239
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
5240
* """
5241
* Return ``t.__new__(t)``. This works even for types like
5242
*/
5243
5244
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *__pyx_v_t) {
5245
PyObject *__pyx_r = NULL;
5246
__Pyx_RefNannyDeclarations
5247
PyObject *__pyx_t_1 = NULL;
5248
__Pyx_RefNannySetupContext("PY_NEW", 0);
5249
5250
/* "sage/ext/stdsage.pxd":22
5251
* optimizations assume that ``tp_new`` doesn't change).
5252
* """
5253
* return (<PyTypeObject*>t).tp_new(t, <object>NULL, <object>NULL) # <<<<<<<<<<<<<<
5254
*
5255
*
5256
*/
5257
__Pyx_XDECREF(__pyx_r);
5258
__pyx_t_1 = ((PyTypeObject *)__pyx_v_t)->tp_new(((PyTypeObject *)__pyx_v_t), ((PyObject *)NULL), ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 22, __pyx_L1_error)
5259
__Pyx_GOTREF(__pyx_t_1);
5260
__pyx_r = __pyx_t_1;
5261
__pyx_t_1 = 0;
5262
goto __pyx_L0;
5263
5264
/* "sage/ext/stdsage.pxd":16
5265
*
5266
*
5267
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
5268
* """
5269
* Return ``t.__new__(t)``. This works even for types like
5270
*/
5271
5272
/* function exit code */
5273
__pyx_L1_error:;
5274
__Pyx_XDECREF(__pyx_t_1);
5275
__Pyx_AddTraceback("sage.ext.stdsage.PY_NEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
5276
__pyx_r = 0;
5277
__pyx_L0:;
5278
__Pyx_XGIVEREF(__pyx_r);
5279
__Pyx_RefNannyFinishContext();
5280
return __pyx_r;
5281
}
5282
5283
/* "sage/ext/stdsage.pxd":25
5284
*
5285
*
5286
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
5287
* """
5288
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
5289
*/
5290
5291
static CYTHON_INLINE void __pyx_f_4sage_3ext_7stdsage_PY_SET_TP_NEW(PyTypeObject *__pyx_v_dst, PyTypeObject *__pyx_v_src) {
5292
__Pyx_RefNannyDeclarations
5293
newfunc __pyx_t_1;
5294
__Pyx_RefNannySetupContext("PY_SET_TP_NEW", 0);
5295
5296
/* "sage/ext/stdsage.pxd":31
5297
* irrelevant base class ``tp_new`` methods.
5298
* """
5299
* (<PyTypeObject*>dst).tp_new = (<PyTypeObject*>src).tp_new # <<<<<<<<<<<<<<
5300
*
5301
*
5302
*/
5303
__pyx_t_1 = ((PyTypeObject *)__pyx_v_src)->tp_new;
5304
((PyTypeObject *)__pyx_v_dst)->tp_new = __pyx_t_1;
5305
5306
/* "sage/ext/stdsage.pxd":25
5307
*
5308
*
5309
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
5310
* """
5311
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
5312
*/
5313
5314
/* function exit code */
5315
__Pyx_RefNannyFinishContext();
5316
}
5317
5318
/* "sage/ext/stdsage.pxd":34
5319
*
5320
*
5321
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
5322
* """
5323
* Test whether the given object has a Python dictionary.
5324
*/
5325
5326
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *__pyx_v_obj) {
5327
int __pyx_r;
5328
__Pyx_RefNannyDeclarations
5329
__Pyx_RefNannySetupContext("HAS_DICTIONARY", 0);
5330
5331
/* "sage/ext/stdsage.pxd":38
5332
* Test whether the given object has a Python dictionary.
5333
* """
5334
* return Py_TYPE(obj).tp_dictoffset != 0 # <<<<<<<<<<<<<<
5335
*/
5336
__pyx_r = (Py_TYPE(__pyx_v_obj)->tp_dictoffset != 0);
5337
goto __pyx_L0;
5338
5339
/* "sage/ext/stdsage.pxd":34
5340
*
5341
*
5342
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
5343
* """
5344
* Test whether the given object has a Python dictionary.
5345
*/
5346
5347
/* function exit code */
5348
__pyx_L0:;
5349
__Pyx_RefNannyFinishContext();
5350
return __pyx_r;
5351
}
5352
5353
/* "cysignals/signals.pxd":35
5354
* # (PyErr_Occurred() is non-NULL). To Cython, it will look like
5355
* # cython_check_exception() actually raised the exception.
5356
* cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<<
5357
* pass
5358
*
5359
*/
5360
5361
static CYTHON_INLINE void __pyx_f_9cysignals_7signals_cython_check_exception(void) {
5362
5363
/* function exit code */
5364
}
5365
static struct __pyx_vtabstruct_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap __pyx_vtable_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap;
5366
5367
static PyObject *__pyx_tp_new_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
5368
struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *p;
5369
PyObject *o;
5370
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
5371
o = (*t->tp_alloc)(t, 0);
5372
} else {
5373
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
5374
}
5375
if (unlikely(!o)) return 0;
5376
p = ((struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)o);
5377
p->__pyx_vtab = __pyx_vtabptr_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap;
5378
p->C = Py_None; Py_INCREF(Py_None);
5379
p->P1 = ((struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *)Py_None); Py_INCREF(Py_None);
5380
if (unlikely(__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
5381
return o;
5382
bad:
5383
Py_DECREF(o); o = 0;
5384
return NULL;
5385
}
5386
5387
static void __pyx_tp_dealloc_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap(PyObject *o) {
5388
struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *p = (struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)o;
5389
#if PY_VERSION_HEX >= 0x030400a1
5390
if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
5391
if (PyObject_CallFinalizerFromDealloc(o)) return;
5392
}
5393
#endif
5394
PyObject_GC_UnTrack(o);
5395
{
5396
PyObject *etype, *eval, *etb;
5397
PyErr_Fetch(&etype, &eval, &etb);
5398
++Py_REFCNT(o);
5399
__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_11__dealloc__(o);
5400
--Py_REFCNT(o);
5401
PyErr_Restore(etype, eval, etb);
5402
}
5403
Py_CLEAR(p->C);
5404
Py_CLEAR(p->P1);
5405
(*Py_TYPE(o)->tp_free)(o);
5406
}
5407
5408
static int __pyx_tp_traverse_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap(PyObject *o, visitproc v, void *a) {
5409
int e;
5410
struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *p = (struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)o;
5411
if (p->C) {
5412
e = (*v)(p->C, a); if (e) return e;
5413
}
5414
if (p->P1) {
5415
e = (*v)(((PyObject*)p->P1), a); if (e) return e;
5416
}
5417
return 0;
5418
}
5419
5420
static int __pyx_tp_clear_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap(PyObject *o) {
5421
PyObject* tmp;
5422
struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *p = (struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *)o;
5423
tmp = ((PyObject*)p->C);
5424
p->C = Py_None; Py_INCREF(Py_None);
5425
Py_XDECREF(tmp);
5426
tmp = ((PyObject*)p->P1);
5427
p->P1 = ((struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List *)Py_None); Py_INCREF(Py_None);
5428
Py_XDECREF(tmp);
5429
return 0;
5430
}
5431
5432
static PyObject *__pyx_getprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_denom(PyObject *o, CYTHON_UNUSED void *x) {
5433
return __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_1__get__(o);
5434
}
5435
5436
static int __pyx_setprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_denom(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
5437
if (v) {
5438
return __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5denom_3__set__(o, v);
5439
}
5440
else {
5441
PyErr_SetString(PyExc_NotImplementedError, "__del__");
5442
return -1;
5443
}
5444
}
5445
5446
static PyObject *__pyx_getprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_C(PyObject *o, CYTHON_UNUSED void *x) {
5447
return __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_1__get__(o);
5448
}
5449
5450
static int __pyx_setprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_C(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
5451
if (v) {
5452
return __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_3__set__(o, v);
5453
}
5454
else {
5455
return __pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_1C_5__del__(o);
5456
}
5457
}
5458
5459
static PyMethodDef __pyx_methods_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap[] = {
5460
{"_init_using_ell_modular_symbol", (PyCFunction)__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_7_init_using_ell_modular_symbol, METH_O, __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_6_init_using_ell_modular_symbol},
5461
{"_init_using_modsym_space", (PyCFunction)__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_9_init_using_modsym_space, METH_O, __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_8_init_using_modsym_space},
5462
{"dimension", (PyCFunction)__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_13dimension, METH_NOARGS, __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_12dimension},
5463
{"_eval0", (PyCFunction)__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_15_eval0, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_14_eval0},
5464
{"_eval1", (PyCFunction)__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_17_eval1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_16_eval1},
5465
{0, 0, 0, 0}
5466
};
5467
5468
static struct PyGetSetDef __pyx_getsets_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap[] = {
5469
{(char *)"denom", __pyx_getprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_denom, __pyx_setprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_denom, (char *)"File: modular_symbol_map.pxd (starting at line 30)", 0},
5470
{(char *)"C", __pyx_getprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_C, __pyx_setprop_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_C, (char *)"File: modular_symbol_map.pxd (starting at line 32)", 0},
5471
{0, 0, 0, 0, 0}
5472
};
5473
5474
static PyTypeObject __pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap = {
5475
PyVarObject_HEAD_INIT(0, 0)
5476
"psage.modform.rational.modular_symbol_map.ModularSymbolMap", /*tp_name*/
5477
sizeof(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap), /*tp_basicsize*/
5478
0, /*tp_itemsize*/
5479
__pyx_tp_dealloc_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, /*tp_dealloc*/
5480
0, /*tp_print*/
5481
0, /*tp_getattr*/
5482
0, /*tp_setattr*/
5483
#if PY_MAJOR_VERSION < 3
5484
0, /*tp_compare*/
5485
#endif
5486
#if PY_MAJOR_VERSION >= 3
5487
0, /*tp_as_async*/
5488
#endif
5489
__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_3__repr__, /*tp_repr*/
5490
0, /*tp_as_number*/
5491
0, /*tp_as_sequence*/
5492
0, /*tp_as_mapping*/
5493
0, /*tp_hash*/
5494
0, /*tp_call*/
5495
0, /*tp_str*/
5496
0, /*tp_getattro*/
5497
0, /*tp_setattro*/
5498
0, /*tp_as_buffer*/
5499
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
5500
0, /*tp_doc*/
5501
__pyx_tp_traverse_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, /*tp_traverse*/
5502
__pyx_tp_clear_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, /*tp_clear*/
5503
0, /*tp_richcompare*/
5504
0, /*tp_weaklistoffset*/
5505
0, /*tp_iter*/
5506
0, /*tp_iternext*/
5507
__pyx_methods_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, /*tp_methods*/
5508
0, /*tp_members*/
5509
__pyx_getsets_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, /*tp_getset*/
5510
0, /*tp_base*/
5511
0, /*tp_dict*/
5512
0, /*tp_descr_get*/
5513
0, /*tp_descr_set*/
5514
0, /*tp_dictoffset*/
5515
__pyx_pw_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_5__init__, /*tp_init*/
5516
0, /*tp_alloc*/
5517
__pyx_tp_new_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, /*tp_new*/
5518
0, /*tp_free*/
5519
0, /*tp_is_gc*/
5520
0, /*tp_bases*/
5521
0, /*tp_mro*/
5522
0, /*tp_cache*/
5523
0, /*tp_subclasses*/
5524
0, /*tp_weaklist*/
5525
0, /*tp_del*/
5526
0, /*tp_version_tag*/
5527
#if PY_VERSION_HEX >= 0x030400a1
5528
0, /*tp_finalize*/
5529
#endif
5530
};
5531
5532
static PyMethodDef __pyx_methods[] = {
5533
{0, 0, 0, 0}
5534
};
5535
5536
#if PY_MAJOR_VERSION >= 3
5537
static struct PyModuleDef __pyx_moduledef = {
5538
#if PY_VERSION_HEX < 0x03020000
5539
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
5540
#else
5541
PyModuleDef_HEAD_INIT,
5542
#endif
5543
"modular_symbol_map",
5544
__pyx_k_File_modular_symbol_map_pyx_star, /* m_doc */
5545
-1, /* m_size */
5546
__pyx_methods /* m_methods */,
5547
NULL, /* m_reload */
5548
NULL, /* m_traverse */
5549
NULL, /* m_clear */
5550
NULL /* m_free */
5551
};
5552
#endif
5553
5554
static __Pyx_StringTabEntry __pyx_string_tab[] = {
5555
{&__pyx_n_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 1},
5556
{&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
5557
{&__pyx_kp_s_A_must_have_sign_1_or_1, __pyx_k_A_must_have_sign_1_or_1, sizeof(__pyx_k_A_must_have_sign_1_or_1), 0, 0, 1, 0},
5558
{&__pyx_kp_s_Creating_modular_symbols_from_ob, __pyx_k_Creating_modular_symbols_from_ob, sizeof(__pyx_k_Creating_modular_symbols_from_ob), 0, 0, 1, 0},
5559
{&__pyx_n_s_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 0, 1, 1},
5560
{&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
5561
{&__pyx_n_s_ModularSymbol, __pyx_k_ModularSymbol, sizeof(__pyx_k_ModularSymbol), 0, 0, 1, 1},
5562
{&__pyx_n_s_ModularSymbolsSpace, __pyx_k_ModularSymbolsSpace, sizeof(__pyx_k_ModularSymbolsSpace), 0, 0, 1, 1},
5563
{&__pyx_kp_s_Modular_symbols_map_for_modular, __pyx_k_Modular_symbols_map_for_modular, sizeof(__pyx_k_Modular_symbols_map_for_modular), 0, 0, 1, 0},
5564
{&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
5565
{&__pyx_n_s_QQ, __pyx_k_QQ, sizeof(__pyx_k_QQ), 0, 0, 1, 1},
5566
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
5567
{&__pyx_n_s_ZZ, __pyx_k_ZZ, sizeof(__pyx_k_ZZ), 0, 0, 1, 1},
5568
{&__pyx_n_s_ZeroDivisionError, __pyx_k_ZeroDivisionError, sizeof(__pyx_k_ZeroDivisionError), 0, 0, 1, 1},
5569
{&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
5570
{&__pyx_n_s_ambient_module, __pyx_k_ambient_module, sizeof(__pyx_k_ambient_module), 0, 0, 1, 1},
5571
{&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
5572
{&__pyx_n_s_basis_matrix, __pyx_k_basis_matrix, sizeof(__pyx_k_basis_matrix), 0, 0, 1, 1},
5573
{&__pyx_n_s_clear_denom, __pyx_k_clear_denom, sizeof(__pyx_k_clear_denom), 0, 0, 1, 1},
5574
{&__pyx_n_s_conductor, __pyx_k_conductor, sizeof(__pyx_k_conductor), 0, 0, 1, 1},
5575
{&__pyx_n_s_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1},
5576
{&__pyx_n_s_dual_free_module, __pyx_k_dual_free_module, sizeof(__pyx_k_dual_free_module), 0, 0, 1, 1},
5577
{&__pyx_n_s_element, __pyx_k_element, sizeof(__pyx_k_element), 0, 0, 1, 1},
5578
{&__pyx_n_s_elliptic_curve, __pyx_k_elliptic_curve, sizeof(__pyx_k_elliptic_curve), 0, 0, 1, 1},
5579
{&__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},
5580
{&__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},
5581
{&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
5582
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
5583
{&__pyx_n_s_init_memory_functions, __pyx_k_init_memory_functions, sizeof(__pyx_k_init_memory_functions), 0, 0, 1, 1},
5584
{&__pyx_n_s_init_using_ell_modular_symbol, __pyx_k_init_using_ell_modular_symbol, sizeof(__pyx_k_init_using_ell_modular_symbol), 0, 0, 1, 1},
5585
{&__pyx_n_s_init_using_modsym_space, __pyx_k_init_using_modsym_space, sizeof(__pyx_k_init_using_modsym_space), 0, 0, 1, 1},
5586
{&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
5587
{&__pyx_n_s_lift_to_sl2z, __pyx_k_lift_to_sl2z, sizeof(__pyx_k_lift_to_sl2z), 0, 0, 1, 1},
5588
{&__pyx_n_s_list, __pyx_k_list, sizeof(__pyx_k_list), 0, 0, 1, 1},
5589
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
5590
{&__pyx_n_s_manin_symbol, __pyx_k_manin_symbol, sizeof(__pyx_k_manin_symbol), 0, 0, 1, 1},
5591
{&__pyx_n_s_matrix, __pyx_k_matrix, sizeof(__pyx_k_matrix), 0, 0, 1, 1},
5592
{&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
5593
{&__pyx_n_s_ncols, __pyx_k_ncols, sizeof(__pyx_k_ncols), 0, 0, 1, 1},
5594
{&__pyx_n_s_nrows, __pyx_k_nrows, sizeof(__pyx_k_nrows), 0, 0, 1, 1},
5595
{&__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},
5596
{&__pyx_n_s_psage_modform_rational_modular_s, __pyx_k_psage_modform_rational_modular_s, sizeof(__pyx_k_psage_modform_rational_modular_s), 0, 0, 1, 1},
5597
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
5598
{&__pyx_n_s_qi, __pyx_k_qi, sizeof(__pyx_k_qi), 0, 0, 1, 1},
5599
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
5600
{&__pyx_n_s_sage_ext_memory, __pyx_k_sage_ext_memory, sizeof(__pyx_k_sage_ext_memory), 0, 0, 1, 1},
5601
{&__pyx_n_s_sage_matrix_all, __pyx_k_sage_matrix_all, sizeof(__pyx_k_sage_matrix_all), 0, 0, 1, 1},
5602
{&__pyx_n_s_sage_modular_modsym_space, __pyx_k_sage_modular_modsym_space, sizeof(__pyx_k_sage_modular_modsym_space), 0, 0, 1, 1},
5603
{&__pyx_n_s_sage_rings_all, __pyx_k_sage_rings_all, sizeof(__pyx_k_sage_rings_all), 0, 0, 1, 1},
5604
{&__pyx_n_s_sage_schemes_elliptic_curves_ell, __pyx_k_sage_schemes_elliptic_curves_ell, sizeof(__pyx_k_sage_schemes_elliptic_curves_ell), 0, 0, 1, 1},
5605
{&__pyx_n_s_sign, __pyx_k_sign, sizeof(__pyx_k_sign), 0, 0, 1, 1},
5606
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
5607
{&__pyx_n_s_test_contfrac_q, __pyx_k_test_contfrac_q, sizeof(__pyx_k_test_contfrac_q), 0, 0, 1, 1},
5608
{&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
5609
{0, 0, 0, 0, 0, 0, 0}
5610
};
5611
static int __Pyx_InitCachedBuiltins(void) {
5612
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 52, __pyx_L1_error)
5613
__pyx_builtin_ZeroDivisionError = __Pyx_GetBuiltinName(__pyx_n_s_ZeroDivisionError); if (!__pyx_builtin_ZeroDivisionError) __PYX_ERR(0, 69, __pyx_L1_error)
5614
__pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 128, __pyx_L1_error)
5615
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 171, __pyx_L1_error)
5616
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 91, __pyx_L1_error)
5617
return 0;
5618
__pyx_L1_error:;
5619
return -1;
5620
}
5621
5622
static int __Pyx_InitCachedConstants(void) {
5623
__Pyx_RefNannyDeclarations
5624
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
5625
5626
/* "psage/modform/rational/modular_symbol_map.pyx":36
5627
* include 'stdsage.pxi'
5628
*
5629
* def test_contfrac_q(a, b): # <<<<<<<<<<<<<<
5630
* """
5631
* EXAMPLES::
5632
*/
5633
__pyx_tuple__2 = PyTuple_Pack(5, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_qi, __pyx_n_s_n, __pyx_n_s_i); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 36, __pyx_L1_error)
5634
__Pyx_GOTREF(__pyx_tuple__2);
5635
__Pyx_GIVEREF(__pyx_tuple__2);
5636
__pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_projects_68c8b2b8_03ba_44d4_a0d, __pyx_n_s_test_contfrac_q, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 36, __pyx_L1_error)
5637
__Pyx_RefNannyFinishContext();
5638
return 0;
5639
__pyx_L1_error:;
5640
__Pyx_RefNannyFinishContext();
5641
return -1;
5642
}
5643
5644
static int __Pyx_InitGlobals(void) {
5645
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5646
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
5647
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
5648
return 0;
5649
__pyx_L1_error:;
5650
return -1;
5651
}
5652
5653
#if PY_MAJOR_VERSION < 3
5654
PyMODINIT_FUNC initmodular_symbol_map(void); /*proto*/
5655
PyMODINIT_FUNC initmodular_symbol_map(void)
5656
#else
5657
PyMODINIT_FUNC PyInit_modular_symbol_map(void); /*proto*/
5658
PyMODINIT_FUNC PyInit_modular_symbol_map(void)
5659
#endif
5660
{
5661
PyObject *__pyx_t_1 = NULL;
5662
PyObject *__pyx_t_2 = NULL;
5663
PyObject *__pyx_t_3 = NULL;
5664
int __pyx_t_4;
5665
__Pyx_RefNannyDeclarations
5666
#if CYTHON_REFNANNY
5667
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
5668
if (!__Pyx_RefNanny) {
5669
PyErr_Clear();
5670
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
5671
if (!__Pyx_RefNanny)
5672
Py_FatalError("failed to import 'refnanny' module");
5673
}
5674
#endif
5675
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_modular_symbol_map(void)", 0);
5676
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5677
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
5678
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
5679
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
5680
#ifdef __Pyx_CyFunction_USED
5681
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5682
#endif
5683
#ifdef __Pyx_FusedFunction_USED
5684
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5685
#endif
5686
#ifdef __Pyx_Coroutine_USED
5687
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5688
#endif
5689
#ifdef __Pyx_Generator_USED
5690
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5691
#endif
5692
#ifdef __Pyx_StopAsyncIteration_USED
5693
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5694
#endif
5695
/*--- Library function declarations ---*/
5696
/*--- Threads initialization code ---*/
5697
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
5698
#ifdef WITH_THREAD /* Python build with threading support? */
5699
PyEval_InitThreads();
5700
#endif
5701
#endif
5702
/*--- Module creation code ---*/
5703
#if PY_MAJOR_VERSION < 3
5704
__pyx_m = Py_InitModule4("modular_symbol_map", __pyx_methods, __pyx_k_File_modular_symbol_map_pyx_star, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
5705
#else
5706
__pyx_m = PyModule_Create(&__pyx_moduledef);
5707
#endif
5708
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
5709
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
5710
Py_INCREF(__pyx_d);
5711
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
5712
#if CYTHON_COMPILING_IN_PYPY
5713
Py_INCREF(__pyx_b);
5714
#endif
5715
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5716
/*--- Initialize various global constants etc. ---*/
5717
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5718
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
5719
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5720
#endif
5721
if (__pyx_module_is_main_psage__modform__rational__modular_symbol_map) {
5722
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5723
}
5724
#if PY_MAJOR_VERSION >= 3
5725
{
5726
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
5727
if (!PyDict_GetItemString(modules, "psage.modform.rational.modular_symbol_map")) {
5728
if (unlikely(PyDict_SetItemString(modules, "psage.modform.rational.modular_symbol_map", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
5729
}
5730
}
5731
#endif
5732
/*--- Builtin init code ---*/
5733
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5734
/*--- Constants init code ---*/
5735
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5736
/*--- Global init code ---*/
5737
/*--- Variable export code ---*/
5738
/*--- Function export code ---*/
5739
/*--- Type init code ---*/
5740
__pyx_vtabptr_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap = &__pyx_vtable_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap;
5741
__pyx_vtable_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap.evaluate = (int (*)(struct __pyx_obj_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap *, long *, long, long))__pyx_f_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_evaluate;
5742
if (PyType_Ready(&__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
5743
__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap.tp_print = 0;
5744
#if CYTHON_COMPILING_IN_CPYTHON
5745
{
5746
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 84, __pyx_L1_error)
5747
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
5748
__pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
5749
__pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__.doc = __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__;
5750
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_2__repr__;
5751
}
5752
}
5753
#endif
5754
#if CYTHON_COMPILING_IN_CPYTHON
5755
{
5756
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 84, __pyx_L1_error)
5757
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
5758
__pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
5759
__pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__.doc = __pyx_doc_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__;
5760
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5psage_7modform_8rational_18modular_symbol_map_16ModularSymbolMap_4__init__;
5761
}
5762
}
5763
#endif
5764
if (__Pyx_SetVtable(__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap.tp_dict, __pyx_vtabptr_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
5765
if (PyObject_SetAttrString(__pyx_m, "ModularSymbolMap", (PyObject *)&__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
5766
__pyx_ptype_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap = &__pyx_type_5psage_7modform_8rational_18modular_symbol_map_ModularSymbolMap;
5767
/*--- Type import code ---*/
5768
__pyx_ptype_4sage_7modular_6modsym_6p1list_export = __Pyx_ImportType("sage.modular.modsym.p1list", "export", sizeof(struct __pyx_obj_4sage_7modular_6modsym_6p1list_export), 1); if (unlikely(!__pyx_ptype_4sage_7modular_6modsym_6p1list_export)) __PYX_ERR(4, 3, __pyx_L1_error)
5769
__pyx_vtabptr_4sage_7modular_6modsym_6p1list_export = (struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_export*)__Pyx_GetVtable(__pyx_ptype_4sage_7modular_6modsym_6p1list_export->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_7modular_6modsym_6p1list_export)) __PYX_ERR(4, 3, __pyx_L1_error)
5770
__pyx_ptype_4sage_7modular_6modsym_6p1list_P1List = __Pyx_ImportType("sage.modular.modsym.p1list", "P1List", sizeof(struct __pyx_obj_4sage_7modular_6modsym_6p1list_P1List), 1); if (unlikely(!__pyx_ptype_4sage_7modular_6modsym_6p1list_P1List)) __PYX_ERR(4, 13, __pyx_L1_error)
5771
__pyx_vtabptr_4sage_7modular_6modsym_6p1list_P1List = (struct __pyx_vtabstruct_4sage_7modular_6modsym_6p1list_P1List*)__Pyx_GetVtable(__pyx_ptype_4sage_7modular_6modsym_6p1list_P1List->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_7modular_6modsym_6p1list_P1List)) __PYX_ERR(4, 13, __pyx_L1_error)
5772
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
5773
#if CYTHON_COMPILING_IN_PYPY
5774
sizeof(PyTypeObject),
5775
#else
5776
sizeof(PyHeapTypeObject),
5777
#endif
5778
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(5, 9, __pyx_L1_error)
5779
/*--- Variable import code ---*/
5780
__pyx_t_1 = __Pyx_ImportModule("cysignals.signals"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
5781
if (__Pyx_ImportVoidPtr(__pyx_t_1, "cysigs", (void **)&__pyx_vp_9cysignals_7signals_cysigs, "cysigs_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5782
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5783
/*--- Function import code ---*/
5784
/*--- Execution code ---*/
5785
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
5786
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5787
#endif
5788
5789
/* "psage/modform/rational/modular_symbol_map.pyx":31
5790
* """
5791
*
5792
* from sage.matrix.all import matrix # <<<<<<<<<<<<<<
5793
* from sage.rings.all import QQ, ZZ, Integer
5794
*
5795
*/
5796
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
5797
__Pyx_GOTREF(__pyx_t_2);
5798
__Pyx_INCREF(__pyx_n_s_matrix);
5799
__Pyx_GIVEREF(__pyx_n_s_matrix);
5800
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_matrix);
5801
__pyx_t_3 = __Pyx_Import(__pyx_n_s_sage_matrix_all, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
5802
__Pyx_GOTREF(__pyx_t_3);
5803
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5804
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
5805
__Pyx_GOTREF(__pyx_t_2);
5806
if (PyDict_SetItem(__pyx_d, __pyx_n_s_matrix, __pyx_t_2) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
5807
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5808
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5809
5810
/* "psage/modform/rational/modular_symbol_map.pyx":32
5811
*
5812
* from sage.matrix.all import matrix
5813
* from sage.rings.all import QQ, ZZ, Integer # <<<<<<<<<<<<<<
5814
*
5815
* include 'stdsage.pxi'
5816
*/
5817
__pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
5818
__Pyx_GOTREF(__pyx_t_3);
5819
__Pyx_INCREF(__pyx_n_s_QQ);
5820
__Pyx_GIVEREF(__pyx_n_s_QQ);
5821
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_QQ);
5822
__Pyx_INCREF(__pyx_n_s_ZZ);
5823
__Pyx_GIVEREF(__pyx_n_s_ZZ);
5824
PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_ZZ);
5825
__Pyx_INCREF(__pyx_n_s_Integer);
5826
__Pyx_GIVEREF(__pyx_n_s_Integer);
5827
PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_Integer);
5828
__pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_rings_all, __pyx_t_3, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
5829
__Pyx_GOTREF(__pyx_t_2);
5830
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5831
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_QQ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
5832
__Pyx_GOTREF(__pyx_t_3);
5833
if (PyDict_SetItem(__pyx_d, __pyx_n_s_QQ, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
5834
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5835
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ZZ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
5836
__Pyx_GOTREF(__pyx_t_3);
5837
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZZ, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
5838
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5839
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
5840
__Pyx_GOTREF(__pyx_t_3);
5841
if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integer, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
5842
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5843
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5844
5845
/* "../../../../../../../sage/sage-7.5/local/lib/python2.7/site-packages/cysignals/signals.pxi":24
5846
* # This *must* be done for every module using interrupt functions
5847
* # otherwise you will get segmentation faults.
5848
* import_cysignals__signals() # <<<<<<<<<<<<<<
5849
*/
5850
__pyx_t_4 = import_cysignals__signals(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(6, 24, __pyx_L1_error)
5851
5852
/* "../../../../../../../sage/sage-7.5/src/sage/ext/stdsage.pxi":24
5853
*
5854
* from sage.ext.stdsage cimport PY_NEW, HAS_DICTIONARY
5855
* from sage.ext.memory import init_memory_functions # <<<<<<<<<<<<<<
5856
*/
5857
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 24, __pyx_L1_error)
5858
__Pyx_GOTREF(__pyx_t_2);
5859
__Pyx_INCREF(__pyx_n_s_init_memory_functions);
5860
__Pyx_GIVEREF(__pyx_n_s_init_memory_functions);
5861
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_init_memory_functions);
5862
__pyx_t_3 = __Pyx_Import(__pyx_n_s_sage_ext_memory, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 24, __pyx_L1_error)
5863
__Pyx_GOTREF(__pyx_t_3);
5864
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5865
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_init_memory_functions); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 24, __pyx_L1_error)
5866
__Pyx_GOTREF(__pyx_t_2);
5867
if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_memory_functions, __pyx_t_2) < 0) __PYX_ERR(7, 24, __pyx_L1_error)
5868
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5869
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5870
5871
/* "psage/modform/rational/modular_symbol_map.pyx":36
5872
* include 'stdsage.pxi'
5873
*
5874
* def test_contfrac_q(a, b): # <<<<<<<<<<<<<<
5875
* """
5876
* EXAMPLES::
5877
*/
5878
__pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5psage_7modform_8rational_18modular_symbol_map_1test_contfrac_q, NULL, __pyx_n_s_psage_modform_rational_modular_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
5879
__Pyx_GOTREF(__pyx_t_3);
5880
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_contfrac_q, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
5881
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5882
5883
/* "psage/modform/rational/modular_symbol_map.pyx":1
5884
* ################################################################################# # <<<<<<<<<<<<<<
5885
* #
5886
* # (c) Copyright 2010 William Stein
5887
*/
5888
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
5889
__Pyx_GOTREF(__pyx_t_3);
5890
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5891
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5892
5893
/* "cysignals/signals.pxd":35
5894
* # (PyErr_Occurred() is non-NULL). To Cython, it will look like
5895
* # cython_check_exception() actually raised the exception.
5896
* cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<<
5897
* pass
5898
*
5899
*/
5900
5901
/*--- Wrapped vars code ---*/
5902
5903
goto __pyx_L0;
5904
__pyx_L1_error:;
5905
__Pyx_XDECREF(__pyx_t_1);
5906
__Pyx_XDECREF(__pyx_t_2);
5907
__Pyx_XDECREF(__pyx_t_3);
5908
if (__pyx_m) {
5909
if (__pyx_d) {
5910
__Pyx_AddTraceback("init psage.modform.rational.modular_symbol_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
5911
}
5912
Py_DECREF(__pyx_m); __pyx_m = 0;
5913
} else if (!PyErr_Occurred()) {
5914
PyErr_SetString(PyExc_ImportError, "init psage.modform.rational.modular_symbol_map");
5915
}
5916
__pyx_L0:;
5917
__Pyx_RefNannyFinishContext();
5918
#if PY_MAJOR_VERSION < 3
5919
return;
5920
#else
5921
return __pyx_m;
5922
#endif
5923
}
5924
5925
/* --- Runtime support code --- */
5926
/* Refnanny */
5927
#if CYTHON_REFNANNY
5928
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
5929
PyObject *m = NULL, *p = NULL;
5930
void *r = NULL;
5931
m = PyImport_ImportModule((char *)modname);
5932
if (!m) goto end;
5933
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
5934
if (!p) goto end;
5935
r = PyLong_AsVoidPtr(p);
5936
end:
5937
Py_XDECREF(p);
5938
Py_XDECREF(m);
5939
return (__Pyx_RefNannyAPIStruct *)r;
5940
}
5941
#endif
5942
5943
/* GetBuiltinName */
5944
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5945
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5946
if (unlikely(!result)) {
5947
PyErr_Format(PyExc_NameError,
5948
#if PY_MAJOR_VERSION >= 3
5949
"name '%U' is not defined", name);
5950
#else
5951
"name '%.200s' is not defined", PyString_AS_STRING(name));
5952
#endif
5953
}
5954
return result;
5955
}
5956
5957
/* RaiseArgTupleInvalid */
5958
static void __Pyx_RaiseArgtupleInvalid(
5959
const char* func_name,
5960
int exact,
5961
Py_ssize_t num_min,
5962
Py_ssize_t num_max,
5963
Py_ssize_t num_found)
5964
{
5965
Py_ssize_t num_expected;
5966
const char *more_or_less;
5967
if (num_found < num_min) {
5968
num_expected = num_min;
5969
more_or_less = "at least";
5970
} else {
5971
num_expected = num_max;
5972
more_or_less = "at most";
5973
}
5974
if (exact) {
5975
more_or_less = "exactly";
5976
}
5977
PyErr_Format(PyExc_TypeError,
5978
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
5979
func_name, more_or_less, num_expected,
5980
(num_expected == 1) ? "" : "s", num_found);
5981
}
5982
5983
/* RaiseDoubleKeywords */
5984
static void __Pyx_RaiseDoubleKeywordsError(
5985
const char* func_name,
5986
PyObject* kw_name)
5987
{
5988
PyErr_Format(PyExc_TypeError,
5989
#if PY_MAJOR_VERSION >= 3
5990
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5991
#else
5992
"%s() got multiple values for keyword argument '%s'", func_name,
5993
PyString_AsString(kw_name));
5994
#endif
5995
}
5996
5997
/* ParseKeywords */
5998
static int __Pyx_ParseOptionalKeywords(
5999
PyObject *kwds,
6000
PyObject **argnames[],
6001
PyObject *kwds2,
6002
PyObject *values[],
6003
Py_ssize_t num_pos_args,
6004
const char* function_name)
6005
{
6006
PyObject *key = 0, *value = 0;
6007
Py_ssize_t pos = 0;
6008
PyObject*** name;
6009
PyObject*** first_kw_arg = argnames + num_pos_args;
6010
while (PyDict_Next(kwds, &pos, &key, &value)) {
6011
name = first_kw_arg;
6012
while (*name && (**name != key)) name++;
6013
if (*name) {
6014
values[name-argnames] = value;
6015
continue;
6016
}
6017
name = first_kw_arg;
6018
#if PY_MAJOR_VERSION < 3
6019
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
6020
while (*name) {
6021
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
6022
&& _PyString_Eq(**name, key)) {
6023
values[name-argnames] = value;
6024
break;
6025
}
6026
name++;
6027
}
6028
if (*name) continue;
6029
else {
6030
PyObject*** argname = argnames;
6031
while (argname != first_kw_arg) {
6032
if ((**argname == key) || (
6033
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
6034
&& _PyString_Eq(**argname, key))) {
6035
goto arg_passed_twice;
6036
}
6037
argname++;
6038
}
6039
}
6040
} else
6041
#endif
6042
if (likely(PyUnicode_Check(key))) {
6043
while (*name) {
6044
int cmp = (**name == key) ? 0 :
6045
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6046
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
6047
#endif
6048
PyUnicode_Compare(**name, key);
6049
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6050
if (cmp == 0) {
6051
values[name-argnames] = value;
6052
break;
6053
}
6054
name++;
6055
}
6056
if (*name) continue;
6057
else {
6058
PyObject*** argname = argnames;
6059
while (argname != first_kw_arg) {
6060
int cmp = (**argname == key) ? 0 :
6061
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6062
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
6063
#endif
6064
PyUnicode_Compare(**argname, key);
6065
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6066
if (cmp == 0) goto arg_passed_twice;
6067
argname++;
6068
}
6069
}
6070
} else
6071
goto invalid_keyword_type;
6072
if (kwds2) {
6073
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
6074
} else {
6075
goto invalid_keyword;
6076
}
6077
}
6078
return 0;
6079
arg_passed_twice:
6080
__Pyx_RaiseDoubleKeywordsError(function_name, key);
6081
goto bad;
6082
invalid_keyword_type:
6083
PyErr_Format(PyExc_TypeError,
6084
"%.200s() keywords must be strings", function_name);
6085
goto bad;
6086
invalid_keyword:
6087
PyErr_Format(PyExc_TypeError,
6088
#if PY_MAJOR_VERSION < 3
6089
"%.200s() got an unexpected keyword argument '%.200s'",
6090
function_name, PyString_AsString(key));
6091
#else
6092
"%s() got an unexpected keyword argument '%U'",
6093
function_name, key);
6094
#endif
6095
bad:
6096
return -1;
6097
}
6098
6099
/* PyErrFetchRestore */
6100
#if CYTHON_FAST_THREAD_STATE
6101
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6102
PyObject *tmp_type, *tmp_value, *tmp_tb;
6103
tmp_type = tstate->curexc_type;
6104
tmp_value = tstate->curexc_value;
6105
tmp_tb = tstate->curexc_traceback;
6106
tstate->curexc_type = type;
6107
tstate->curexc_value = value;
6108
tstate->curexc_traceback = tb;
6109
Py_XDECREF(tmp_type);
6110
Py_XDECREF(tmp_value);
6111
Py_XDECREF(tmp_tb);
6112
}
6113
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6114
*type = tstate->curexc_type;
6115
*value = tstate->curexc_value;
6116
*tb = tstate->curexc_traceback;
6117
tstate->curexc_type = 0;
6118
tstate->curexc_value = 0;
6119
tstate->curexc_traceback = 0;
6120
}
6121
#endif
6122
6123
/* RaiseException */
6124
#if PY_MAJOR_VERSION < 3
6125
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6126
CYTHON_UNUSED PyObject *cause) {
6127
__Pyx_PyThreadState_declare
6128
Py_XINCREF(type);
6129
if (!value || value == Py_None)
6130
value = NULL;
6131
else
6132
Py_INCREF(value);
6133
if (!tb || tb == Py_None)
6134
tb = NULL;
6135
else {
6136
Py_INCREF(tb);
6137
if (!PyTraceBack_Check(tb)) {
6138
PyErr_SetString(PyExc_TypeError,
6139
"raise: arg 3 must be a traceback or None");
6140
goto raise_error;
6141
}
6142
}
6143
if (PyType_Check(type)) {
6144
#if CYTHON_COMPILING_IN_PYPY
6145
if (!value) {
6146
Py_INCREF(Py_None);
6147
value = Py_None;
6148
}
6149
#endif
6150
PyErr_NormalizeException(&type, &value, &tb);
6151
} else {
6152
if (value) {
6153
PyErr_SetString(PyExc_TypeError,
6154
"instance exception may not have a separate value");
6155
goto raise_error;
6156
}
6157
value = type;
6158
type = (PyObject*) Py_TYPE(type);
6159
Py_INCREF(type);
6160
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6161
PyErr_SetString(PyExc_TypeError,
6162
"raise: exception class must be a subclass of BaseException");
6163
goto raise_error;
6164
}
6165
}
6166
__Pyx_PyThreadState_assign
6167
__Pyx_ErrRestore(type, value, tb);
6168
return;
6169
raise_error:
6170
Py_XDECREF(value);
6171
Py_XDECREF(type);
6172
Py_XDECREF(tb);
6173
return;
6174
}
6175
#else
6176
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6177
PyObject* owned_instance = NULL;
6178
if (tb == Py_None) {
6179
tb = 0;
6180
} else if (tb && !PyTraceBack_Check(tb)) {
6181
PyErr_SetString(PyExc_TypeError,
6182
"raise: arg 3 must be a traceback or None");
6183
goto bad;
6184
}
6185
if (value == Py_None)
6186
value = 0;
6187
if (PyExceptionInstance_Check(type)) {
6188
if (value) {
6189
PyErr_SetString(PyExc_TypeError,
6190
"instance exception may not have a separate value");
6191
goto bad;
6192
}
6193
value = type;
6194
type = (PyObject*) Py_TYPE(value);
6195
} else if (PyExceptionClass_Check(type)) {
6196
PyObject *instance_class = NULL;
6197
if (value && PyExceptionInstance_Check(value)) {
6198
instance_class = (PyObject*) Py_TYPE(value);
6199
if (instance_class != type) {
6200
int is_subclass = PyObject_IsSubclass(instance_class, type);
6201
if (!is_subclass) {
6202
instance_class = NULL;
6203
} else if (unlikely(is_subclass == -1)) {
6204
goto bad;
6205
} else {
6206
type = instance_class;
6207
}
6208
}
6209
}
6210
if (!instance_class) {
6211
PyObject *args;
6212
if (!value)
6213
args = PyTuple_New(0);
6214
else if (PyTuple_Check(value)) {
6215
Py_INCREF(value);
6216
args = value;
6217
} else
6218
args = PyTuple_Pack(1, value);
6219
if (!args)
6220
goto bad;
6221
owned_instance = PyObject_Call(type, args, NULL);
6222
Py_DECREF(args);
6223
if (!owned_instance)
6224
goto bad;
6225
value = owned_instance;
6226
if (!PyExceptionInstance_Check(value)) {
6227
PyErr_Format(PyExc_TypeError,
6228
"calling %R should have returned an instance of "
6229
"BaseException, not %R",
6230
type, Py_TYPE(value));
6231
goto bad;
6232
}
6233
}
6234
} else {
6235
PyErr_SetString(PyExc_TypeError,
6236
"raise: exception class must be a subclass of BaseException");
6237
goto bad;
6238
}
6239
#if PY_VERSION_HEX >= 0x03030000
6240
if (cause) {
6241
#else
6242
if (cause && cause != Py_None) {
6243
#endif
6244
PyObject *fixed_cause;
6245
if (cause == Py_None) {
6246
fixed_cause = NULL;
6247
} else if (PyExceptionClass_Check(cause)) {
6248
fixed_cause = PyObject_CallObject(cause, NULL);
6249
if (fixed_cause == NULL)
6250
goto bad;
6251
} else if (PyExceptionInstance_Check(cause)) {
6252
fixed_cause = cause;
6253
Py_INCREF(fixed_cause);
6254
} else {
6255
PyErr_SetString(PyExc_TypeError,
6256
"exception causes must derive from "
6257
"BaseException");
6258
goto bad;
6259
}
6260
PyException_SetCause(value, fixed_cause);
6261
}
6262
PyErr_SetObject(type, value);
6263
if (tb) {
6264
#if CYTHON_COMPILING_IN_PYPY
6265
PyObject *tmp_type, *tmp_value, *tmp_tb;
6266
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6267
Py_INCREF(tb);
6268
PyErr_Restore(tmp_type, tmp_value, tb);
6269
Py_XDECREF(tmp_tb);
6270
#else
6271
PyThreadState *tstate = PyThreadState_GET();
6272
PyObject* tmp_tb = tstate->curexc_traceback;
6273
if (tb != tmp_tb) {
6274
Py_INCREF(tb);
6275
tstate->curexc_traceback = tb;
6276
Py_XDECREF(tmp_tb);
6277
}
6278
#endif
6279
}
6280
bad:
6281
Py_XDECREF(owned_instance);
6282
return;
6283
}
6284
#endif
6285
6286
/* None */
6287
static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
6288
long r = a % b;
6289
r += ((r != 0) & ((r ^ b) < 0)) * b;
6290
return r;
6291
}
6292
6293
/* None */
6294
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
6295
long q = a / b;
6296
long r = a - q*b;
6297
q -= ((r != 0) & ((r ^ b) < 0));
6298
return q;
6299
}
6300
6301
/* KeywordStringCheck */
6302
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
6303
PyObject *kwdict,
6304
const char* function_name,
6305
int kw_allowed)
6306
{
6307
PyObject* key = 0;
6308
Py_ssize_t pos = 0;
6309
#if CYTHON_COMPILING_IN_PYPY
6310
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
6311
goto invalid_keyword;
6312
return 1;
6313
#else
6314
while (PyDict_Next(kwdict, &pos, &key, 0)) {
6315
#if PY_MAJOR_VERSION < 3
6316
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
6317
#endif
6318
if (unlikely(!PyUnicode_Check(key)))
6319
goto invalid_keyword_type;
6320
}
6321
if ((!kw_allowed) && unlikely(key))
6322
goto invalid_keyword;
6323
return 1;
6324
invalid_keyword_type:
6325
PyErr_Format(PyExc_TypeError,
6326
"%.200s() keywords must be strings", function_name);
6327
return 0;
6328
#endif
6329
invalid_keyword:
6330
PyErr_Format(PyExc_TypeError,
6331
#if PY_MAJOR_VERSION < 3
6332
"%.200s() got an unexpected keyword argument '%.200s'",
6333
function_name, PyString_AsString(key));
6334
#else
6335
"%s() got an unexpected keyword argument '%U'",
6336
function_name, key);
6337
#endif
6338
return 0;
6339
}
6340
6341
/* Import */
6342
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
6343
PyObject *empty_list = 0;
6344
PyObject *module = 0;
6345
PyObject *global_dict = 0;
6346
PyObject *empty_dict = 0;
6347
PyObject *list;
6348
#if PY_VERSION_HEX < 0x03030000
6349
PyObject *py_import;
6350
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
6351
if (!py_import)
6352
goto bad;
6353
#endif
6354
if (from_list)
6355
list = from_list;
6356
else {
6357
empty_list = PyList_New(0);
6358
if (!empty_list)
6359
goto bad;
6360
list = empty_list;
6361
}
6362
global_dict = PyModule_GetDict(__pyx_m);
6363
if (!global_dict)
6364
goto bad;
6365
empty_dict = PyDict_New();
6366
if (!empty_dict)
6367
goto bad;
6368
{
6369
#if PY_MAJOR_VERSION >= 3
6370
if (level == -1) {
6371
if (strchr(__Pyx_MODULE_NAME, '.')) {
6372
#if PY_VERSION_HEX < 0x03030000
6373
PyObject *py_level = PyInt_FromLong(1);
6374
if (!py_level)
6375
goto bad;
6376
module = PyObject_CallFunctionObjArgs(py_import,
6377
name, global_dict, empty_dict, list, py_level, NULL);
6378
Py_DECREF(py_level);
6379
#else
6380
module = PyImport_ImportModuleLevelObject(
6381
name, global_dict, empty_dict, list, 1);
6382
#endif
6383
if (!module) {
6384
if (!PyErr_ExceptionMatches(PyExc_ImportError))
6385
goto bad;
6386
PyErr_Clear();
6387
}
6388
}
6389
level = 0;
6390
}
6391
#endif
6392
if (!module) {
6393
#if PY_VERSION_HEX < 0x03030000
6394
PyObject *py_level = PyInt_FromLong(level);
6395
if (!py_level)
6396
goto bad;
6397
module = PyObject_CallFunctionObjArgs(py_import,
6398
name, global_dict, empty_dict, list, py_level, NULL);
6399
Py_DECREF(py_level);
6400
#else
6401
module = PyImport_ImportModuleLevelObject(
6402
name, global_dict, empty_dict, list, level);
6403
#endif
6404
}
6405
}
6406
bad:
6407
#if PY_VERSION_HEX < 0x03030000
6408
Py_XDECREF(py_import);
6409
#endif
6410
Py_XDECREF(empty_list);
6411
Py_XDECREF(empty_dict);
6412
return module;
6413
}
6414
6415
/* ImportFrom */
6416
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
6417
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
6418
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
6419
PyErr_Format(PyExc_ImportError,
6420
#if PY_MAJOR_VERSION < 3
6421
"cannot import name %.230s", PyString_AS_STRING(name));
6422
#else
6423
"cannot import name %S", name);
6424
#endif
6425
}
6426
return value;
6427
}
6428
6429
/* PyCFunctionFastCall */
6430
#if CYTHON_FAST_PYCCALL
6431
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
6432
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
6433
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6434
PyObject *self = PyCFunction_GET_SELF(func);
6435
assert(PyCFunction_Check(func));
6436
assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
6437
assert(nargs >= 0);
6438
assert(nargs == 0 || args != NULL);
6439
/* _PyCFunction_FastCallDict() must not be called with an exception set,
6440
because it may clear it (directly or indirectly) and so the
6441
caller loses its exception */
6442
assert(!PyErr_Occurred());
6443
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
6444
}
6445
#endif // CYTHON_FAST_PYCCALL
6446
6447
/* PyFunctionFastCall */
6448
#if CYTHON_FAST_PYCALL
6449
#include "frameobject.h"
6450
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
6451
PyObject *globals) {
6452
PyFrameObject *f;
6453
PyThreadState *tstate = PyThreadState_GET();
6454
PyObject **fastlocals;
6455
Py_ssize_t i;
6456
PyObject *result;
6457
assert(globals != NULL);
6458
/* XXX Perhaps we should create a specialized
6459
PyFrame_New() that doesn't take locals, but does
6460
take builtins without sanity checking them.
6461
*/
6462
assert(tstate != NULL);
6463
f = PyFrame_New(tstate, co, globals, NULL);
6464
if (f == NULL) {
6465
return NULL;
6466
}
6467
fastlocals = f->f_localsplus;
6468
for (i = 0; i < na; i++) {
6469
Py_INCREF(*args);
6470
fastlocals[i] = *args++;
6471
}
6472
result = PyEval_EvalFrameEx(f,0);
6473
++tstate->recursion_depth;
6474
Py_DECREF(f);
6475
--tstate->recursion_depth;
6476
return result;
6477
}
6478
#if 1 || PY_VERSION_HEX < 0x030600B1
6479
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
6480
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
6481
PyObject *globals = PyFunction_GET_GLOBALS(func);
6482
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
6483
PyObject *closure;
6484
#if PY_MAJOR_VERSION >= 3
6485
PyObject *kwdefs;
6486
#endif
6487
PyObject *kwtuple, **k;
6488
PyObject **d;
6489
Py_ssize_t nd;
6490
Py_ssize_t nk;
6491
PyObject *result;
6492
assert(kwargs == NULL || PyDict_Check(kwargs));
6493
nk = kwargs ? PyDict_Size(kwargs) : 0;
6494
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
6495
return NULL;
6496
}
6497
if (
6498
#if PY_MAJOR_VERSION >= 3
6499
co->co_kwonlyargcount == 0 &&
6500
#endif
6501
likely(kwargs == NULL || nk == 0) &&
6502
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
6503
if (argdefs == NULL && co->co_argcount == nargs) {
6504
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
6505
goto done;
6506
}
6507
else if (nargs == 0 && argdefs != NULL
6508
&& co->co_argcount == Py_SIZE(argdefs)) {
6509
/* function called with no arguments, but all parameters have
6510
a default value: use default values as arguments .*/
6511
args = &PyTuple_GET_ITEM(argdefs, 0);
6512
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
6513
goto done;
6514
}
6515
}
6516
if (kwargs != NULL) {
6517
Py_ssize_t pos, i;
6518
kwtuple = PyTuple_New(2 * nk);
6519
if (kwtuple == NULL) {
6520
result = NULL;
6521
goto done;
6522
}
6523
k = &PyTuple_GET_ITEM(kwtuple, 0);
6524
pos = i = 0;
6525
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
6526
Py_INCREF(k[i]);
6527
Py_INCREF(k[i+1]);
6528
i += 2;
6529
}
6530
nk = i / 2;
6531
}
6532
else {
6533
kwtuple = NULL;
6534
k = NULL;
6535
}
6536
closure = PyFunction_GET_CLOSURE(func);
6537
#if PY_MAJOR_VERSION >= 3
6538
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
6539
#endif
6540
if (argdefs != NULL) {
6541
d = &PyTuple_GET_ITEM(argdefs, 0);
6542
nd = Py_SIZE(argdefs);
6543
}
6544
else {
6545
d = NULL;
6546
nd = 0;
6547
}
6548
#if PY_MAJOR_VERSION >= 3
6549
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
6550
args, nargs,
6551
k, (int)nk,
6552
d, (int)nd, kwdefs, closure);
6553
#else
6554
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
6555
args, nargs,
6556
k, (int)nk,
6557
d, (int)nd, closure);
6558
#endif
6559
Py_XDECREF(kwtuple);
6560
done:
6561
Py_LeaveRecursiveCall();
6562
return result;
6563
}
6564
#endif // CPython < 3.6
6565
#endif // CYTHON_FAST_PYCALL
6566
6567
/* PyObjectCall */
6568
#if CYTHON_COMPILING_IN_CPYTHON
6569
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6570
PyObject *result;
6571
ternaryfunc call = func->ob_type->tp_call;
6572
if (unlikely(!call))
6573
return PyObject_Call(func, arg, kw);
6574
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6575
return NULL;
6576
result = (*call)(func, arg, kw);
6577
Py_LeaveRecursiveCall();
6578
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6579
PyErr_SetString(
6580
PyExc_SystemError,
6581
"NULL result without error in PyObject_Call");
6582
}
6583
return result;
6584
}
6585
#endif
6586
6587
/* PyObjectCallMethO */
6588
#if CYTHON_COMPILING_IN_CPYTHON
6589
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
6590
PyObject *self, *result;
6591
PyCFunction cfunc;
6592
cfunc = PyCFunction_GET_FUNCTION(func);
6593
self = PyCFunction_GET_SELF(func);
6594
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6595
return NULL;
6596
result = cfunc(self, arg);
6597
Py_LeaveRecursiveCall();
6598
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6599
PyErr_SetString(
6600
PyExc_SystemError,
6601
"NULL result without error in PyObject_Call");
6602
}
6603
return result;
6604
}
6605
#endif
6606
6607
/* PyObjectCallOneArg */
6608
#if CYTHON_COMPILING_IN_CPYTHON
6609
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6610
PyObject *result;
6611
PyObject *args = PyTuple_New(1);
6612
if (unlikely(!args)) return NULL;
6613
Py_INCREF(arg);
6614
PyTuple_SET_ITEM(args, 0, arg);
6615
result = __Pyx_PyObject_Call(func, args, NULL);
6616
Py_DECREF(args);
6617
return result;
6618
}
6619
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6620
#if CYTHON_FAST_PYCALL
6621
if (PyFunction_Check(func)) {
6622
return __Pyx_PyFunction_FastCall(func, &arg, 1);
6623
}
6624
#endif
6625
#ifdef __Pyx_CyFunction_USED
6626
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
6627
#else
6628
if (likely(PyCFunction_Check(func))) {
6629
#endif
6630
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
6631
return __Pyx_PyObject_CallMethO(func, arg);
6632
#if CYTHON_FAST_PYCCALL
6633
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
6634
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
6635
#endif
6636
}
6637
}
6638
return __Pyx__PyObject_CallOneArg(func, arg);
6639
}
6640
#else
6641
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6642
PyObject *result;
6643
PyObject *args = PyTuple_Pack(1, arg);
6644
if (unlikely(!args)) return NULL;
6645
result = __Pyx_PyObject_Call(func, args, NULL);
6646
Py_DECREF(args);
6647
return result;
6648
}
6649
#endif
6650
6651
/* PyObjectCallNoArg */
6652
#if CYTHON_COMPILING_IN_CPYTHON
6653
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
6654
#if CYTHON_FAST_PYCALL
6655
if (PyFunction_Check(func)) {
6656
return __Pyx_PyFunction_FastCall(func, NULL, 0);
6657
}
6658
#endif
6659
#ifdef __Pyx_CyFunction_USED
6660
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
6661
#else
6662
if (likely(PyCFunction_Check(func))) {
6663
#endif
6664
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
6665
return __Pyx_PyObject_CallMethO(func, NULL);
6666
}
6667
}
6668
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
6669
}
6670
#endif
6671
6672
/* RaiseTooManyValuesToUnpack */
6673
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
6674
PyErr_Format(PyExc_ValueError,
6675
"too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
6676
}
6677
6678
/* RaiseNeedMoreValuesToUnpack */
6679
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
6680
PyErr_Format(PyExc_ValueError,
6681
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
6682
index, (index == 1) ? "" : "s");
6683
}
6684
6685
/* IterFinish */
6686
static CYTHON_INLINE int __Pyx_IterFinish(void) {
6687
#if CYTHON_FAST_THREAD_STATE
6688
PyThreadState *tstate = PyThreadState_GET();
6689
PyObject* exc_type = tstate->curexc_type;
6690
if (unlikely(exc_type)) {
6691
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
6692
PyObject *exc_value, *exc_tb;
6693
exc_value = tstate->curexc_value;
6694
exc_tb = tstate->curexc_traceback;
6695
tstate->curexc_type = 0;
6696
tstate->curexc_value = 0;
6697
tstate->curexc_traceback = 0;
6698
Py_DECREF(exc_type);
6699
Py_XDECREF(exc_value);
6700
Py_XDECREF(exc_tb);
6701
return 0;
6702
} else {
6703
return -1;
6704
}
6705
}
6706
return 0;
6707
#else
6708
if (unlikely(PyErr_Occurred())) {
6709
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
6710
PyErr_Clear();
6711
return 0;
6712
} else {
6713
return -1;
6714
}
6715
}
6716
return 0;
6717
#endif
6718
}
6719
6720
/* UnpackItemEndCheck */
6721
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
6722
if (unlikely(retval)) {
6723
Py_DECREF(retval);
6724
__Pyx_RaiseTooManyValuesError(expected);
6725
return -1;
6726
} else {
6727
return __Pyx_IterFinish();
6728
}
6729
return 0;
6730
}
6731
6732
/* GetModuleGlobalName */
6733
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
6734
PyObject *result;
6735
#if !CYTHON_AVOID_BORROWED_REFS
6736
result = PyDict_GetItem(__pyx_d, name);
6737
if (likely(result)) {
6738
Py_INCREF(result);
6739
} else {
6740
#else
6741
result = PyObject_GetItem(__pyx_d, name);
6742
if (!result) {
6743
PyErr_Clear();
6744
#endif
6745
result = __Pyx_GetBuiltinName(name);
6746
}
6747
return result;
6748
}
6749
6750
/* PyIntBinop */
6751
#if !CYTHON_COMPILING_IN_PYPY
6752
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
6753
if (op1 == op2) {
6754
Py_RETURN_TRUE;
6755
}
6756
#if PY_MAJOR_VERSION < 3
6757
if (likely(PyInt_CheckExact(op1))) {
6758
const long b = intval;
6759
long a = PyInt_AS_LONG(op1);
6760
if (a == b) {
6761
Py_RETURN_TRUE;
6762
} else {
6763
Py_RETURN_FALSE;
6764
}
6765
}
6766
#endif
6767
#if CYTHON_USE_PYLONG_INTERNALS
6768
if (likely(PyLong_CheckExact(op1))) {
6769
const long b = intval;
6770
long a;
6771
const digit* digits = ((PyLongObject*)op1)->ob_digit;
6772
const Py_ssize_t size = Py_SIZE(op1);
6773
if (likely(__Pyx_sst_abs(size) <= 1)) {
6774
a = likely(size) ? digits[0] : 0;
6775
if (size == -1) a = -a;
6776
} else {
6777
switch (size) {
6778
case -2:
6779
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6780
a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6781
break;
6782
}
6783
case 2:
6784
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6785
a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6786
break;
6787
}
6788
case -3:
6789
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6790
a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6791
break;
6792
}
6793
case 3:
6794
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6795
a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6796
break;
6797
}
6798
case -4:
6799
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6800
a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6801
break;
6802
}
6803
case 4:
6804
if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6805
a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6806
break;
6807
}
6808
#if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
6809
default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
6810
#else
6811
default: Py_RETURN_FALSE;
6812
#endif
6813
}
6814
}
6815
if (a == b) {
6816
Py_RETURN_TRUE;
6817
} else {
6818
Py_RETURN_FALSE;
6819
}
6820
}
6821
#endif
6822
if (PyFloat_CheckExact(op1)) {
6823
const long b = intval;
6824
double a = PyFloat_AS_DOUBLE(op1);
6825
if ((double)a == (double)b) {
6826
Py_RETURN_TRUE;
6827
} else {
6828
Py_RETURN_FALSE;
6829
}
6830
}
6831
return PyObject_RichCompare(op1, op2, Py_EQ);
6832
}
6833
#endif
6834
6835
/* SetVTable */
6836
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
6837
#if PY_VERSION_HEX >= 0x02070000
6838
PyObject *ob = PyCapsule_New(vtable, 0, 0);
6839
#else
6840
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
6841
#endif
6842
if (!ob)
6843
goto bad;
6844
if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
6845
goto bad;
6846
Py_DECREF(ob);
6847
return 0;
6848
bad:
6849
Py_XDECREF(ob);
6850
return -1;
6851
}
6852
6853
/* GetVTable */
6854
static void* __Pyx_GetVtable(PyObject *dict) {
6855
void* ptr;
6856
PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
6857
if (!ob)
6858
goto bad;
6859
#if PY_VERSION_HEX >= 0x02070000
6860
ptr = PyCapsule_GetPointer(ob, 0);
6861
#else
6862
ptr = PyCObject_AsVoidPtr(ob);
6863
#endif
6864
if (!ptr && !PyErr_Occurred())
6865
PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
6866
Py_DECREF(ob);
6867
return ptr;
6868
bad:
6869
Py_XDECREF(ob);
6870
return NULL;
6871
}
6872
6873
/* CodeObjectCache */
6874
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
6875
int start = 0, mid = 0, end = count - 1;
6876
if (end >= 0 && code_line > entries[end].code_line) {
6877
return count;
6878
}
6879
while (start < end) {
6880
mid = start + (end - start) / 2;
6881
if (code_line < entries[mid].code_line) {
6882
end = mid;
6883
} else if (code_line > entries[mid].code_line) {
6884
start = mid + 1;
6885
} else {
6886
return mid;
6887
}
6888
}
6889
if (code_line <= entries[mid].code_line) {
6890
return mid;
6891
} else {
6892
return mid + 1;
6893
}
6894
}
6895
static PyCodeObject *__pyx_find_code_object(int code_line) {
6896
PyCodeObject* code_object;
6897
int pos;
6898
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
6899
return NULL;
6900
}
6901
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6902
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
6903
return NULL;
6904
}
6905
code_object = __pyx_code_cache.entries[pos].code_object;
6906
Py_INCREF(code_object);
6907
return code_object;
6908
}
6909
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
6910
int pos, i;
6911
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
6912
if (unlikely(!code_line)) {
6913
return;
6914
}
6915
if (unlikely(!entries)) {
6916
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
6917
if (likely(entries)) {
6918
__pyx_code_cache.entries = entries;
6919
__pyx_code_cache.max_count = 64;
6920
__pyx_code_cache.count = 1;
6921
entries[0].code_line = code_line;
6922
entries[0].code_object = code_object;
6923
Py_INCREF(code_object);
6924
}
6925
return;
6926
}
6927
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
6928
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
6929
PyCodeObject* tmp = entries[pos].code_object;
6930
entries[pos].code_object = code_object;
6931
Py_DECREF(tmp);
6932
return;
6933
}
6934
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
6935
int new_max = __pyx_code_cache.max_count + 64;
6936
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
6937
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
6938
if (unlikely(!entries)) {
6939
return;
6940
}
6941
__pyx_code_cache.entries = entries;
6942
__pyx_code_cache.max_count = new_max;
6943
}
6944
for (i=__pyx_code_cache.count; i>pos; i--) {
6945
entries[i] = entries[i-1];
6946
}
6947
entries[pos].code_line = code_line;
6948
entries[pos].code_object = code_object;
6949
__pyx_code_cache.count++;
6950
Py_INCREF(code_object);
6951
}
6952
6953
/* AddTraceback */
6954
#include "compile.h"
6955
#include "frameobject.h"
6956
#include "traceback.h"
6957
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
6958
const char *funcname, int c_line,
6959
int py_line, const char *filename) {
6960
PyCodeObject *py_code = 0;
6961
PyObject *py_srcfile = 0;
6962
PyObject *py_funcname = 0;
6963
#if PY_MAJOR_VERSION < 3
6964
py_srcfile = PyString_FromString(filename);
6965
#else
6966
py_srcfile = PyUnicode_FromString(filename);
6967
#endif
6968
if (!py_srcfile) goto bad;
6969
if (c_line) {
6970
#if PY_MAJOR_VERSION < 3
6971
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6972
#else
6973
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6974
#endif
6975
}
6976
else {
6977
#if PY_MAJOR_VERSION < 3
6978
py_funcname = PyString_FromString(funcname);
6979
#else
6980
py_funcname = PyUnicode_FromString(funcname);
6981
#endif
6982
}
6983
if (!py_funcname) goto bad;
6984
py_code = __Pyx_PyCode_New(
6985
0,
6986
0,
6987
0,
6988
0,
6989
0,
6990
__pyx_empty_bytes, /*PyObject *code,*/
6991
__pyx_empty_tuple, /*PyObject *consts,*/
6992
__pyx_empty_tuple, /*PyObject *names,*/
6993
__pyx_empty_tuple, /*PyObject *varnames,*/
6994
__pyx_empty_tuple, /*PyObject *freevars,*/
6995
__pyx_empty_tuple, /*PyObject *cellvars,*/
6996
py_srcfile, /*PyObject *filename,*/
6997
py_funcname, /*PyObject *name,*/
6998
py_line,
6999
__pyx_empty_bytes /*PyObject *lnotab*/
7000
);
7001
Py_DECREF(py_srcfile);
7002
Py_DECREF(py_funcname);
7003
return py_code;
7004
bad:
7005
Py_XDECREF(py_srcfile);
7006
Py_XDECREF(py_funcname);
7007
return NULL;
7008
}
7009
static void __Pyx_AddTraceback(const char *funcname, int c_line,
7010
int py_line, const char *filename) {
7011
PyCodeObject *py_code = 0;
7012
PyFrameObject *py_frame = 0;
7013
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
7014
if (!py_code) {
7015
py_code = __Pyx_CreateCodeObjectForTraceback(
7016
funcname, c_line, py_line, filename);
7017
if (!py_code) goto bad;
7018
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
7019
}
7020
py_frame = PyFrame_New(
7021
PyThreadState_GET(), /*PyThreadState *tstate,*/
7022
py_code, /*PyCodeObject *code,*/
7023
__pyx_d, /*PyObject *globals,*/
7024
0 /*PyObject *locals*/
7025
);
7026
if (!py_frame) goto bad;
7027
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
7028
PyTraceBack_Here(py_frame);
7029
bad:
7030
Py_XDECREF(py_code);
7031
Py_XDECREF(py_frame);
7032
}
7033
7034
/* CIntFromPyVerify */
7035
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
7036
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
7037
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
7038
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
7039
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
7040
{\
7041
func_type value = func_value;\
7042
if (sizeof(target_type) < sizeof(func_type)) {\
7043
if (unlikely(value != (func_type) (target_type) value)) {\
7044
func_type zero = 0;\
7045
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
7046
return (target_type) -1;\
7047
if (is_unsigned && unlikely(value < zero))\
7048
goto raise_neg_overflow;\
7049
else\
7050
goto raise_overflow;\
7051
}\
7052
}\
7053
return (target_type) value;\
7054
}
7055
7056
/* CIntToPy */
7057
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
7058
const int neg_one = (int) -1, const_zero = (int) 0;
7059
const int is_unsigned = neg_one > const_zero;
7060
if (is_unsigned) {
7061
if (sizeof(int) < sizeof(long)) {
7062
return PyInt_FromLong((long) value);
7063
} else if (sizeof(int) <= sizeof(unsigned long)) {
7064
return PyLong_FromUnsignedLong((unsigned long) value);
7065
#ifdef HAVE_LONG_LONG
7066
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
7067
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7068
#endif
7069
}
7070
} else {
7071
if (sizeof(int) <= sizeof(long)) {
7072
return PyInt_FromLong((long) value);
7073
#ifdef HAVE_LONG_LONG
7074
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
7075
return PyLong_FromLongLong((PY_LONG_LONG) value);
7076
#endif
7077
}
7078
}
7079
{
7080
int one = 1; int little = (int)*(unsigned char *)&one;
7081
unsigned char *bytes = (unsigned char *)&value;
7082
return _PyLong_FromByteArray(bytes, sizeof(int),
7083
little, !is_unsigned);
7084
}
7085
}
7086
7087
/* CIntToPy */
7088
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
7089
const long neg_one = (long) -1, const_zero = (long) 0;
7090
const int is_unsigned = neg_one > const_zero;
7091
if (is_unsigned) {
7092
if (sizeof(long) < sizeof(long)) {
7093
return PyInt_FromLong((long) value);
7094
} else if (sizeof(long) <= sizeof(unsigned long)) {
7095
return PyLong_FromUnsignedLong((unsigned long) value);
7096
#ifdef HAVE_LONG_LONG
7097
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
7098
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
7099
#endif
7100
}
7101
} else {
7102
if (sizeof(long) <= sizeof(long)) {
7103
return PyInt_FromLong((long) value);
7104
#ifdef HAVE_LONG_LONG
7105
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
7106
return PyLong_FromLongLong((PY_LONG_LONG) value);
7107
#endif
7108
}
7109
}
7110
{
7111
int one = 1; int little = (int)*(unsigned char *)&one;
7112
unsigned char *bytes = (unsigned char *)&value;
7113
return _PyLong_FromByteArray(bytes, sizeof(long),
7114
little, !is_unsigned);
7115
}
7116
}
7117
7118
/* CIntFromPy */
7119
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
7120
const long neg_one = (long) -1, const_zero = (long) 0;
7121
const int is_unsigned = neg_one > const_zero;
7122
#if PY_MAJOR_VERSION < 3
7123
if (likely(PyInt_Check(x))) {
7124
if (sizeof(long) < sizeof(long)) {
7125
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
7126
} else {
7127
long val = PyInt_AS_LONG(x);
7128
if (is_unsigned && unlikely(val < 0)) {
7129
goto raise_neg_overflow;
7130
}
7131
return (long) val;
7132
}
7133
} else
7134
#endif
7135
if (likely(PyLong_Check(x))) {
7136
if (is_unsigned) {
7137
#if CYTHON_USE_PYLONG_INTERNALS
7138
const digit* digits = ((PyLongObject*)x)->ob_digit;
7139
switch (Py_SIZE(x)) {
7140
case 0: return (long) 0;
7141
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
7142
case 2:
7143
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
7144
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7145
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7146
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
7147
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7148
}
7149
}
7150
break;
7151
case 3:
7152
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
7153
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7154
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7155
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
7156
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7157
}
7158
}
7159
break;
7160
case 4:
7161
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
7162
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7163
__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])))
7164
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
7165
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
7166
}
7167
}
7168
break;
7169
}
7170
#endif
7171
#if CYTHON_COMPILING_IN_CPYTHON
7172
if (unlikely(Py_SIZE(x) < 0)) {
7173
goto raise_neg_overflow;
7174
}
7175
#else
7176
{
7177
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7178
if (unlikely(result < 0))
7179
return (long) -1;
7180
if (unlikely(result == 1))
7181
goto raise_neg_overflow;
7182
}
7183
#endif
7184
if (sizeof(long) <= sizeof(unsigned long)) {
7185
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
7186
#ifdef HAVE_LONG_LONG
7187
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
7188
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7189
#endif
7190
}
7191
} else {
7192
#if CYTHON_USE_PYLONG_INTERNALS
7193
const digit* digits = ((PyLongObject*)x)->ob_digit;
7194
switch (Py_SIZE(x)) {
7195
case 0: return (long) 0;
7196
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
7197
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
7198
case -2:
7199
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
7200
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7201
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7202
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7203
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7204
}
7205
}
7206
break;
7207
case 2:
7208
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
7209
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7210
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7211
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7212
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7213
}
7214
}
7215
break;
7216
case -3:
7217
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7218
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7219
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7220
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7221
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7222
}
7223
}
7224
break;
7225
case 3:
7226
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
7227
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7228
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7229
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7230
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7231
}
7232
}
7233
break;
7234
case -4:
7235
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7236
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7237
__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])))
7238
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
7239
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7240
}
7241
}
7242
break;
7243
case 4:
7244
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
7245
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7246
__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])))
7247
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
7248
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
7249
}
7250
}
7251
break;
7252
}
7253
#endif
7254
if (sizeof(long) <= sizeof(long)) {
7255
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
7256
#ifdef HAVE_LONG_LONG
7257
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
7258
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
7259
#endif
7260
}
7261
}
7262
{
7263
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7264
PyErr_SetString(PyExc_RuntimeError,
7265
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7266
#else
7267
long val;
7268
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7269
#if PY_MAJOR_VERSION < 3
7270
if (likely(v) && !PyLong_Check(v)) {
7271
PyObject *tmp = v;
7272
v = PyNumber_Long(tmp);
7273
Py_DECREF(tmp);
7274
}
7275
#endif
7276
if (likely(v)) {
7277
int one = 1; int is_little = (int)*(unsigned char *)&one;
7278
unsigned char *bytes = (unsigned char *)&val;
7279
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7280
bytes, sizeof(val),
7281
is_little, !is_unsigned);
7282
Py_DECREF(v);
7283
if (likely(!ret))
7284
return val;
7285
}
7286
#endif
7287
return (long) -1;
7288
}
7289
} else {
7290
long val;
7291
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7292
if (!tmp) return (long) -1;
7293
val = __Pyx_PyInt_As_long(tmp);
7294
Py_DECREF(tmp);
7295
return val;
7296
}
7297
raise_overflow:
7298
PyErr_SetString(PyExc_OverflowError,
7299
"value too large to convert to long");
7300
return (long) -1;
7301
raise_neg_overflow:
7302
PyErr_SetString(PyExc_OverflowError,
7303
"can't convert negative value to long");
7304
return (long) -1;
7305
}
7306
7307
/* CIntFromPy */
7308
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
7309
const int neg_one = (int) -1, const_zero = (int) 0;
7310
const int is_unsigned = neg_one > const_zero;
7311
#if PY_MAJOR_VERSION < 3
7312
if (likely(PyInt_Check(x))) {
7313
if (sizeof(int) < sizeof(long)) {
7314
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
7315
} else {
7316
long val = PyInt_AS_LONG(x);
7317
if (is_unsigned && unlikely(val < 0)) {
7318
goto raise_neg_overflow;
7319
}
7320
return (int) val;
7321
}
7322
} else
7323
#endif
7324
if (likely(PyLong_Check(x))) {
7325
if (is_unsigned) {
7326
#if CYTHON_USE_PYLONG_INTERNALS
7327
const digit* digits = ((PyLongObject*)x)->ob_digit;
7328
switch (Py_SIZE(x)) {
7329
case 0: return (int) 0;
7330
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
7331
case 2:
7332
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
7333
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7334
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7335
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
7336
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7337
}
7338
}
7339
break;
7340
case 3:
7341
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
7342
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7343
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7344
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
7345
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7346
}
7347
}
7348
break;
7349
case 4:
7350
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
7351
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7352
__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])))
7353
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
7354
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
7355
}
7356
}
7357
break;
7358
}
7359
#endif
7360
#if CYTHON_COMPILING_IN_CPYTHON
7361
if (unlikely(Py_SIZE(x) < 0)) {
7362
goto raise_neg_overflow;
7363
}
7364
#else
7365
{
7366
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7367
if (unlikely(result < 0))
7368
return (int) -1;
7369
if (unlikely(result == 1))
7370
goto raise_neg_overflow;
7371
}
7372
#endif
7373
if (sizeof(int) <= sizeof(unsigned long)) {
7374
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
7375
#ifdef HAVE_LONG_LONG
7376
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
7377
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7378
#endif
7379
}
7380
} else {
7381
#if CYTHON_USE_PYLONG_INTERNALS
7382
const digit* digits = ((PyLongObject*)x)->ob_digit;
7383
switch (Py_SIZE(x)) {
7384
case 0: return (int) 0;
7385
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
7386
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
7387
case -2:
7388
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
7389
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7390
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7391
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7392
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7393
}
7394
}
7395
break;
7396
case 2:
7397
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
7398
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7399
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7400
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7401
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7402
}
7403
}
7404
break;
7405
case -3:
7406
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
7407
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7408
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7409
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7410
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7411
}
7412
}
7413
break;
7414
case 3:
7415
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
7416
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7417
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7418
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7419
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7420
}
7421
}
7422
break;
7423
case -4:
7424
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
7425
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7426
__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])))
7427
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
7428
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7429
}
7430
}
7431
break;
7432
case 4:
7433
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
7434
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7435
__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])))
7436
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
7437
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
7438
}
7439
}
7440
break;
7441
}
7442
#endif
7443
if (sizeof(int) <= sizeof(long)) {
7444
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
7445
#ifdef HAVE_LONG_LONG
7446
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
7447
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
7448
#endif
7449
}
7450
}
7451
{
7452
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7453
PyErr_SetString(PyExc_RuntimeError,
7454
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7455
#else
7456
int val;
7457
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7458
#if PY_MAJOR_VERSION < 3
7459
if (likely(v) && !PyLong_Check(v)) {
7460
PyObject *tmp = v;
7461
v = PyNumber_Long(tmp);
7462
Py_DECREF(tmp);
7463
}
7464
#endif
7465
if (likely(v)) {
7466
int one = 1; int is_little = (int)*(unsigned char *)&one;
7467
unsigned char *bytes = (unsigned char *)&val;
7468
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7469
bytes, sizeof(val),
7470
is_little, !is_unsigned);
7471
Py_DECREF(v);
7472
if (likely(!ret))
7473
return val;
7474
}
7475
#endif
7476
return (int) -1;
7477
}
7478
} else {
7479
int val;
7480
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7481
if (!tmp) return (int) -1;
7482
val = __Pyx_PyInt_As_int(tmp);
7483
Py_DECREF(tmp);
7484
return val;
7485
}
7486
raise_overflow:
7487
PyErr_SetString(PyExc_OverflowError,
7488
"value too large to convert to int");
7489
return (int) -1;
7490
raise_neg_overflow:
7491
PyErr_SetString(PyExc_OverflowError,
7492
"can't convert negative value to int");
7493
return (int) -1;
7494
}
7495
7496
/* CIntFromPy */
7497
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
7498
const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
7499
const int is_unsigned = neg_one > const_zero;
7500
#if PY_MAJOR_VERSION < 3
7501
if (likely(PyInt_Check(x))) {
7502
if (sizeof(size_t) < sizeof(long)) {
7503
__PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
7504
} else {
7505
long val = PyInt_AS_LONG(x);
7506
if (is_unsigned && unlikely(val < 0)) {
7507
goto raise_neg_overflow;
7508
}
7509
return (size_t) val;
7510
}
7511
} else
7512
#endif
7513
if (likely(PyLong_Check(x))) {
7514
if (is_unsigned) {
7515
#if CYTHON_USE_PYLONG_INTERNALS
7516
const digit* digits = ((PyLongObject*)x)->ob_digit;
7517
switch (Py_SIZE(x)) {
7518
case 0: return (size_t) 0;
7519
case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
7520
case 2:
7521
if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
7522
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7523
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7524
} else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
7525
return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7526
}
7527
}
7528
break;
7529
case 3:
7530
if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
7531
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7532
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7533
} else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
7534
return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7535
}
7536
}
7537
break;
7538
case 4:
7539
if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
7540
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7541
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7542
} else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
7543
return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7544
}
7545
}
7546
break;
7547
}
7548
#endif
7549
#if CYTHON_COMPILING_IN_CPYTHON
7550
if (unlikely(Py_SIZE(x) < 0)) {
7551
goto raise_neg_overflow;
7552
}
7553
#else
7554
{
7555
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
7556
if (unlikely(result < 0))
7557
return (size_t) -1;
7558
if (unlikely(result == 1))
7559
goto raise_neg_overflow;
7560
}
7561
#endif
7562
if (sizeof(size_t) <= sizeof(unsigned long)) {
7563
__PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
7564
#ifdef HAVE_LONG_LONG
7565
} else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
7566
__PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
7567
#endif
7568
}
7569
} else {
7570
#if CYTHON_USE_PYLONG_INTERNALS
7571
const digit* digits = ((PyLongObject*)x)->ob_digit;
7572
switch (Py_SIZE(x)) {
7573
case 0: return (size_t) 0;
7574
case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
7575
case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
7576
case -2:
7577
if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
7578
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7579
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7580
} else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
7581
return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
7582
}
7583
}
7584
break;
7585
case 2:
7586
if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
7587
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
7588
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7589
} else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
7590
return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
7591
}
7592
}
7593
break;
7594
case -3:
7595
if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
7596
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7597
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7598
} else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
7599
return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
7600
}
7601
}
7602
break;
7603
case 3:
7604
if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
7605
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
7606
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7607
} else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
7608
return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
7609
}
7610
}
7611
break;
7612
case -4:
7613
if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
7614
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7615
__PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7616
} else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
7617
return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
7618
}
7619
}
7620
break;
7621
case 4:
7622
if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
7623
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
7624
__PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
7625
} else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
7626
return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
7627
}
7628
}
7629
break;
7630
}
7631
#endif
7632
if (sizeof(size_t) <= sizeof(long)) {
7633
__PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
7634
#ifdef HAVE_LONG_LONG
7635
} else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
7636
__PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
7637
#endif
7638
}
7639
}
7640
{
7641
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
7642
PyErr_SetString(PyExc_RuntimeError,
7643
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
7644
#else
7645
size_t val;
7646
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
7647
#if PY_MAJOR_VERSION < 3
7648
if (likely(v) && !PyLong_Check(v)) {
7649
PyObject *tmp = v;
7650
v = PyNumber_Long(tmp);
7651
Py_DECREF(tmp);
7652
}
7653
#endif
7654
if (likely(v)) {
7655
int one = 1; int is_little = (int)*(unsigned char *)&one;
7656
unsigned char *bytes = (unsigned char *)&val;
7657
int ret = _PyLong_AsByteArray((PyLongObject *)v,
7658
bytes, sizeof(val),
7659
is_little, !is_unsigned);
7660
Py_DECREF(v);
7661
if (likely(!ret))
7662
return val;
7663
}
7664
#endif
7665
return (size_t) -1;
7666
}
7667
} else {
7668
size_t val;
7669
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
7670
if (!tmp) return (size_t) -1;
7671
val = __Pyx_PyInt_As_size_t(tmp);
7672
Py_DECREF(tmp);
7673
return val;
7674
}
7675
raise_overflow:
7676
PyErr_SetString(PyExc_OverflowError,
7677
"value too large to convert to size_t");
7678
return (size_t) -1;
7679
raise_neg_overflow:
7680
PyErr_SetString(PyExc_OverflowError,
7681
"can't convert negative value to size_t");
7682
return (size_t) -1;
7683
}
7684
7685
/* CheckBinaryVersion */
7686
static int __Pyx_check_binary_version(void) {
7687
char ctversion[4], rtversion[4];
7688
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
7689
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
7690
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
7691
char message[200];
7692
PyOS_snprintf(message, sizeof(message),
7693
"compiletime version %s of module '%.100s' "
7694
"does not match runtime version %s",
7695
ctversion, __Pyx_MODULE_NAME, rtversion);
7696
return PyErr_WarnEx(NULL, message, 1);
7697
}
7698
return 0;
7699
}
7700
7701
/* ModuleImport */
7702
#ifndef __PYX_HAVE_RT_ImportModule
7703
#define __PYX_HAVE_RT_ImportModule
7704
static PyObject *__Pyx_ImportModule(const char *name) {
7705
PyObject *py_name = 0;
7706
PyObject *py_module = 0;
7707
py_name = __Pyx_PyIdentifier_FromString(name);
7708
if (!py_name)
7709
goto bad;
7710
py_module = PyImport_Import(py_name);
7711
Py_DECREF(py_name);
7712
return py_module;
7713
bad:
7714
Py_XDECREF(py_name);
7715
return 0;
7716
}
7717
#endif
7718
7719
/* TypeImport */
7720
#ifndef __PYX_HAVE_RT_ImportType
7721
#define __PYX_HAVE_RT_ImportType
7722
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
7723
size_t size, int strict)
7724
{
7725
PyObject *py_module = 0;
7726
PyObject *result = 0;
7727
PyObject *py_name = 0;
7728
char warning[200];
7729
Py_ssize_t basicsize;
7730
#ifdef Py_LIMITED_API
7731
PyObject *py_basicsize;
7732
#endif
7733
py_module = __Pyx_ImportModule(module_name);
7734
if (!py_module)
7735
goto bad;
7736
py_name = __Pyx_PyIdentifier_FromString(class_name);
7737
if (!py_name)
7738
goto bad;
7739
result = PyObject_GetAttr(py_module, py_name);
7740
Py_DECREF(py_name);
7741
py_name = 0;
7742
Py_DECREF(py_module);
7743
py_module = 0;
7744
if (!result)
7745
goto bad;
7746
if (!PyType_Check(result)) {
7747
PyErr_Format(PyExc_TypeError,
7748
"%.200s.%.200s is not a type object",
7749
module_name, class_name);
7750
goto bad;
7751
}
7752
#ifndef Py_LIMITED_API
7753
basicsize = ((PyTypeObject *)result)->tp_basicsize;
7754
#else
7755
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
7756
if (!py_basicsize)
7757
goto bad;
7758
basicsize = PyLong_AsSsize_t(py_basicsize);
7759
Py_DECREF(py_basicsize);
7760
py_basicsize = 0;
7761
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
7762
goto bad;
7763
#endif
7764
if (!strict && (size_t)basicsize > size) {
7765
PyOS_snprintf(warning, sizeof(warning),
7766
"%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
7767
module_name, class_name, basicsize, size);
7768
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
7769
}
7770
else if ((size_t)basicsize != size) {
7771
PyErr_Format(PyExc_ValueError,
7772
"%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
7773
module_name, class_name, basicsize, size);
7774
goto bad;
7775
}
7776
return (PyTypeObject *)result;
7777
bad:
7778
Py_XDECREF(py_module);
7779
Py_XDECREF(result);
7780
return NULL;
7781
}
7782
#endif
7783
7784
/* VoidPtrImport */
7785
#ifndef __PYX_HAVE_RT_ImportVoidPtr
7786
#define __PYX_HAVE_RT_ImportVoidPtr
7787
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
7788
PyObject *d = 0;
7789
PyObject *cobj = 0;
7790
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
7791
if (!d)
7792
goto bad;
7793
cobj = PyDict_GetItemString(d, name);
7794
if (!cobj) {
7795
PyErr_Format(PyExc_ImportError,
7796
"%.200s does not export expected C variable %.200s",
7797
PyModule_GetName(module), name);
7798
goto bad;
7799
}
7800
#if PY_VERSION_HEX >= 0x02070000
7801
if (!PyCapsule_IsValid(cobj, sig)) {
7802
PyErr_Format(PyExc_TypeError,
7803
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
7804
PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
7805
goto bad;
7806
}
7807
*p = PyCapsule_GetPointer(cobj, sig);
7808
#else
7809
{const char *desc, *s1, *s2;
7810
desc = (const char *)PyCObject_GetDesc(cobj);
7811
if (!desc)
7812
goto bad;
7813
s1 = desc; s2 = sig;
7814
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
7815
if (*s1 != *s2) {
7816
PyErr_Format(PyExc_TypeError,
7817
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
7818
PyModule_GetName(module), name, sig, desc);
7819
goto bad;
7820
}
7821
*p = PyCObject_AsVoidPtr(cobj);}
7822
#endif
7823
if (!(*p))
7824
goto bad;
7825
Py_DECREF(d);
7826
return 0;
7827
bad:
7828
Py_XDECREF(d);
7829
return -1;
7830
}
7831
#endif
7832
7833
/* InitStrings */
7834
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
7835
while (t->p) {
7836
#if PY_MAJOR_VERSION < 3
7837
if (t->is_unicode) {
7838
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
7839
} else if (t->intern) {
7840
*t->p = PyString_InternFromString(t->s);
7841
} else {
7842
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
7843
}
7844
#else
7845
if (t->is_unicode | t->is_str) {
7846
if (t->intern) {
7847
*t->p = PyUnicode_InternFromString(t->s);
7848
} else if (t->encoding) {
7849
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
7850
} else {
7851
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
7852
}
7853
} else {
7854
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
7855
}
7856
#endif
7857
if (!*t->p)
7858
return -1;
7859
++t;
7860
}
7861
return 0;
7862
}
7863
7864
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
7865
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
7866
}
7867
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
7868
Py_ssize_t ignore;
7869
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
7870
}
7871
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7872
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
7873
if (
7874
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7875
__Pyx_sys_getdefaultencoding_not_ascii &&
7876
#endif
7877
PyUnicode_Check(o)) {
7878
#if PY_VERSION_HEX < 0x03030000
7879
char* defenc_c;
7880
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
7881
if (!defenc) return NULL;
7882
defenc_c = PyBytes_AS_STRING(defenc);
7883
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7884
{
7885
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
7886
char* c;
7887
for (c = defenc_c; c < end; c++) {
7888
if ((unsigned char) (*c) >= 128) {
7889
PyUnicode_AsASCIIString(o);
7890
return NULL;
7891
}
7892
}
7893
}
7894
#endif
7895
*length = PyBytes_GET_SIZE(defenc);
7896
return defenc_c;
7897
#else
7898
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
7899
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7900
if (PyUnicode_IS_ASCII(o)) {
7901
*length = PyUnicode_GET_LENGTH(o);
7902
return PyUnicode_AsUTF8(o);
7903
} else {
7904
PyUnicode_AsASCIIString(o);
7905
return NULL;
7906
}
7907
#else
7908
return PyUnicode_AsUTF8AndSize(o, length);
7909
#endif
7910
#endif
7911
} else
7912
#endif
7913
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
7914
if (PyByteArray_Check(o)) {
7915
*length = PyByteArray_GET_SIZE(o);
7916
return PyByteArray_AS_STRING(o);
7917
} else
7918
#endif
7919
{
7920
char* result;
7921
int r = PyBytes_AsStringAndSize(o, &result, length);
7922
if (unlikely(r < 0)) {
7923
return NULL;
7924
} else {
7925
return result;
7926
}
7927
}
7928
}
7929
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
7930
int is_true = x == Py_True;
7931
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
7932
else return PyObject_IsTrue(x);
7933
}
7934
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
7935
#if CYTHON_USE_TYPE_SLOTS
7936
PyNumberMethods *m;
7937
#endif
7938
const char *name = NULL;
7939
PyObject *res = NULL;
7940
#if PY_MAJOR_VERSION < 3
7941
if (PyInt_Check(x) || PyLong_Check(x))
7942
#else
7943
if (PyLong_Check(x))
7944
#endif
7945
return __Pyx_NewRef(x);
7946
#if CYTHON_USE_TYPE_SLOTS
7947
m = Py_TYPE(x)->tp_as_number;
7948
#if PY_MAJOR_VERSION < 3
7949
if (m && m->nb_int) {
7950
name = "int";
7951
res = PyNumber_Int(x);
7952
}
7953
else if (m && m->nb_long) {
7954
name = "long";
7955
res = PyNumber_Long(x);
7956
}
7957
#else
7958
if (m && m->nb_int) {
7959
name = "int";
7960
res = PyNumber_Long(x);
7961
}
7962
#endif
7963
#else
7964
res = PyNumber_Int(x);
7965
#endif
7966
if (res) {
7967
#if PY_MAJOR_VERSION < 3
7968
if (!PyInt_Check(res) && !PyLong_Check(res)) {
7969
#else
7970
if (!PyLong_Check(res)) {
7971
#endif
7972
PyErr_Format(PyExc_TypeError,
7973
"__%.4s__ returned non-%.4s (type %.200s)",
7974
name, name, Py_TYPE(res)->tp_name);
7975
Py_DECREF(res);
7976
return NULL;
7977
}
7978
}
7979
else if (!PyErr_Occurred()) {
7980
PyErr_SetString(PyExc_TypeError,
7981
"an integer is required");
7982
}
7983
return res;
7984
}
7985
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
7986
Py_ssize_t ival;
7987
PyObject *x;
7988
#if PY_MAJOR_VERSION < 3
7989
if (likely(PyInt_CheckExact(b))) {
7990
if (sizeof(Py_ssize_t) >= sizeof(long))
7991
return PyInt_AS_LONG(b);
7992
else
7993
return PyInt_AsSsize_t(x);
7994
}
7995
#endif
7996
if (likely(PyLong_CheckExact(b))) {
7997
#if CYTHON_USE_PYLONG_INTERNALS
7998
const digit* digits = ((PyLongObject*)b)->ob_digit;
7999
const Py_ssize_t size = Py_SIZE(b);
8000
if (likely(__Pyx_sst_abs(size) <= 1)) {
8001
ival = likely(size) ? digits[0] : 0;
8002
if (size == -1) ival = -ival;
8003
return ival;
8004
} else {
8005
switch (size) {
8006
case 2:
8007
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8008
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8009
}
8010
break;
8011
case -2:
8012
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
8013
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8014
}
8015
break;
8016
case 3:
8017
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8018
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8019
}
8020
break;
8021
case -3:
8022
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
8023
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
8024
}
8025
break;
8026
case 4:
8027
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8028
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]));
8029
}
8030
break;
8031
case -4:
8032
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
8033
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]));
8034
}
8035
break;
8036
}
8037
}
8038
#endif
8039
return PyLong_AsSsize_t(b);
8040
}
8041
x = PyNumber_Index(b);
8042
if (!x) return -1;
8043
ival = PyInt_AsSsize_t(x);
8044
Py_DECREF(x);
8045
return ival;
8046
}
8047
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
8048
return PyInt_FromSize_t(ival);
8049
}
8050
8051
8052
#endif /* Py_PYTHON_H */
8053
8054