Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241818 views
1
/* Generated by Cython 0.25.2 */
2
3
#define PY_SSIZE_T_CLEAN
4
#include "Python.h"
5
#ifndef Py_PYTHON_H
6
#error Python headers needed to compile C extensions, please install development version of Python.
7
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8
#error Cython requires Python 2.6+ or Python 3.2+.
9
#else
10
#define CYTHON_ABI "0_25_2"
11
#include <stddef.h>
12
#ifndef offsetof
13
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14
#endif
15
#if !defined(WIN32) && !defined(MS_WINDOWS)
16
#ifndef __stdcall
17
#define __stdcall
18
#endif
19
#ifndef __cdecl
20
#define __cdecl
21
#endif
22
#ifndef __fastcall
23
#define __fastcall
24
#endif
25
#endif
26
#ifndef DL_IMPORT
27
#define DL_IMPORT(t) t
28
#endif
29
#ifndef DL_EXPORT
30
#define DL_EXPORT(t) t
31
#endif
32
#ifndef HAVE_LONG_LONG
33
#if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34
#define HAVE_LONG_LONG
35
#endif
36
#endif
37
#ifndef PY_LONG_LONG
38
#define PY_LONG_LONG LONG_LONG
39
#endif
40
#ifndef Py_HUGE_VAL
41
#define Py_HUGE_VAL HUGE_VAL
42
#endif
43
#ifdef PYPY_VERSION
44
#define CYTHON_COMPILING_IN_PYPY 1
45
#define CYTHON_COMPILING_IN_PYSTON 0
46
#define CYTHON_COMPILING_IN_CPYTHON 0
47
#undef CYTHON_USE_TYPE_SLOTS
48
#define CYTHON_USE_TYPE_SLOTS 0
49
#undef CYTHON_USE_ASYNC_SLOTS
50
#define CYTHON_USE_ASYNC_SLOTS 0
51
#undef CYTHON_USE_PYLIST_INTERNALS
52
#define CYTHON_USE_PYLIST_INTERNALS 0
53
#undef CYTHON_USE_UNICODE_INTERNALS
54
#define CYTHON_USE_UNICODE_INTERNALS 0
55
#undef CYTHON_USE_UNICODE_WRITER
56
#define CYTHON_USE_UNICODE_WRITER 0
57
#undef CYTHON_USE_PYLONG_INTERNALS
58
#define CYTHON_USE_PYLONG_INTERNALS 0
59
#undef CYTHON_AVOID_BORROWED_REFS
60
#define CYTHON_AVOID_BORROWED_REFS 1
61
#undef CYTHON_ASSUME_SAFE_MACROS
62
#define CYTHON_ASSUME_SAFE_MACROS 0
63
#undef CYTHON_UNPACK_METHODS
64
#define CYTHON_UNPACK_METHODS 0
65
#undef CYTHON_FAST_THREAD_STATE
66
#define CYTHON_FAST_THREAD_STATE 0
67
#undef CYTHON_FAST_PYCALL
68
#define CYTHON_FAST_PYCALL 0
69
#elif defined(PYSTON_VERSION)
70
#define CYTHON_COMPILING_IN_PYPY 0
71
#define CYTHON_COMPILING_IN_PYSTON 1
72
#define CYTHON_COMPILING_IN_CPYTHON 0
73
#ifndef CYTHON_USE_TYPE_SLOTS
74
#define CYTHON_USE_TYPE_SLOTS 1
75
#endif
76
#undef CYTHON_USE_ASYNC_SLOTS
77
#define CYTHON_USE_ASYNC_SLOTS 0
78
#undef CYTHON_USE_PYLIST_INTERNALS
79
#define CYTHON_USE_PYLIST_INTERNALS 0
80
#ifndef CYTHON_USE_UNICODE_INTERNALS
81
#define CYTHON_USE_UNICODE_INTERNALS 1
82
#endif
83
#undef CYTHON_USE_UNICODE_WRITER
84
#define CYTHON_USE_UNICODE_WRITER 0
85
#undef CYTHON_USE_PYLONG_INTERNALS
86
#define CYTHON_USE_PYLONG_INTERNALS 0
87
#ifndef CYTHON_AVOID_BORROWED_REFS
88
#define CYTHON_AVOID_BORROWED_REFS 0
89
#endif
90
#ifndef CYTHON_ASSUME_SAFE_MACROS
91
#define CYTHON_ASSUME_SAFE_MACROS 1
92
#endif
93
#ifndef CYTHON_UNPACK_METHODS
94
#define CYTHON_UNPACK_METHODS 1
95
#endif
96
#undef CYTHON_FAST_THREAD_STATE
97
#define CYTHON_FAST_THREAD_STATE 0
98
#undef CYTHON_FAST_PYCALL
99
#define CYTHON_FAST_PYCALL 0
100
#else
101
#define CYTHON_COMPILING_IN_PYPY 0
102
#define CYTHON_COMPILING_IN_PYSTON 0
103
#define CYTHON_COMPILING_IN_CPYTHON 1
104
#ifndef CYTHON_USE_TYPE_SLOTS
105
#define CYTHON_USE_TYPE_SLOTS 1
106
#endif
107
#if PY_MAJOR_VERSION < 3
108
#undef CYTHON_USE_ASYNC_SLOTS
109
#define CYTHON_USE_ASYNC_SLOTS 0
110
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
111
#define CYTHON_USE_ASYNC_SLOTS 1
112
#endif
113
#if PY_VERSION_HEX < 0x02070000
114
#undef CYTHON_USE_PYLONG_INTERNALS
115
#define CYTHON_USE_PYLONG_INTERNALS 0
116
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
117
#define CYTHON_USE_PYLONG_INTERNALS 1
118
#endif
119
#ifndef CYTHON_USE_PYLIST_INTERNALS
120
#define CYTHON_USE_PYLIST_INTERNALS 1
121
#endif
122
#ifndef CYTHON_USE_UNICODE_INTERNALS
123
#define CYTHON_USE_UNICODE_INTERNALS 1
124
#endif
125
#if PY_VERSION_HEX < 0x030300F0
126
#undef CYTHON_USE_UNICODE_WRITER
127
#define CYTHON_USE_UNICODE_WRITER 0
128
#elif !defined(CYTHON_USE_UNICODE_WRITER)
129
#define CYTHON_USE_UNICODE_WRITER 1
130
#endif
131
#ifndef CYTHON_AVOID_BORROWED_REFS
132
#define CYTHON_AVOID_BORROWED_REFS 0
133
#endif
134
#ifndef CYTHON_ASSUME_SAFE_MACROS
135
#define CYTHON_ASSUME_SAFE_MACROS 1
136
#endif
137
#ifndef CYTHON_UNPACK_METHODS
138
#define CYTHON_UNPACK_METHODS 1
139
#endif
140
#ifndef CYTHON_FAST_THREAD_STATE
141
#define CYTHON_FAST_THREAD_STATE 1
142
#endif
143
#ifndef CYTHON_FAST_PYCALL
144
#define CYTHON_FAST_PYCALL 1
145
#endif
146
#endif
147
#if !defined(CYTHON_FAST_PYCCALL)
148
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
149
#endif
150
#if CYTHON_USE_PYLONG_INTERNALS
151
#include "longintrepr.h"
152
#undef SHIFT
153
#undef BASE
154
#undef MASK
155
#endif
156
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157
#define Py_OptimizeFlag 0
158
#endif
159
#define __PYX_BUILD_PY_SSIZE_T "n"
160
#define CYTHON_FORMAT_SSIZE_T "z"
161
#if PY_MAJOR_VERSION < 3
162
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
163
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
164
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
165
#define __Pyx_DefaultClassType PyClass_Type
166
#else
167
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
168
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
169
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
170
#define __Pyx_DefaultClassType PyType_Type
171
#endif
172
#ifndef Py_TPFLAGS_CHECKTYPES
173
#define Py_TPFLAGS_CHECKTYPES 0
174
#endif
175
#ifndef Py_TPFLAGS_HAVE_INDEX
176
#define Py_TPFLAGS_HAVE_INDEX 0
177
#endif
178
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
180
#endif
181
#ifndef Py_TPFLAGS_HAVE_FINALIZE
182
#define Py_TPFLAGS_HAVE_FINALIZE 0
183
#endif
184
#ifndef METH_FASTCALL
185
#define METH_FASTCALL 0x80
186
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
187
Py_ssize_t nargs, PyObject *kwnames);
188
#else
189
#define __Pyx_PyCFunctionFast _PyCFunctionFast
190
#endif
191
#if CYTHON_FAST_PYCCALL
192
#define __Pyx_PyFastCFunction_Check(func)\
193
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
194
#else
195
#define __Pyx_PyFastCFunction_Check(func) 0
196
#endif
197
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
198
#define CYTHON_PEP393_ENABLED 1
199
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
200
0 : _PyUnicode_Ready((PyObject *)(op)))
201
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
202
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
203
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
204
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
205
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
206
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
207
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
208
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
209
#else
210
#define CYTHON_PEP393_ENABLED 0
211
#define PyUnicode_1BYTE_KIND 1
212
#define PyUnicode_2BYTE_KIND 2
213
#define PyUnicode_4BYTE_KIND 4
214
#define __Pyx_PyUnicode_READY(op) (0)
215
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
216
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
217
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
218
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
219
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
220
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
221
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
222
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
223
#endif
224
#if CYTHON_COMPILING_IN_PYPY
225
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
226
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
227
#else
228
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
229
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
230
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
231
#endif
232
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
234
#endif
235
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
237
#endif
238
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
240
#endif
241
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
242
#define PyObject_Malloc(s) PyMem_Malloc(s)
243
#define PyObject_Free(p) PyMem_Free(p)
244
#define PyObject_Realloc(p) PyMem_Realloc(p)
245
#endif
246
#if CYTHON_COMPILING_IN_PYSTON
247
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
248
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
249
#else
250
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
251
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
252
#endif
253
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
254
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
255
#if PY_MAJOR_VERSION >= 3
256
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
257
#else
258
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
259
#endif
260
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261
#define PyObject_ASCII(o) PyObject_Repr(o)
262
#endif
263
#if PY_MAJOR_VERSION >= 3
264
#define PyBaseString_Type PyUnicode_Type
265
#define PyStringObject PyUnicodeObject
266
#define PyString_Type PyUnicode_Type
267
#define PyString_Check PyUnicode_Check
268
#define PyString_CheckExact PyUnicode_CheckExact
269
#endif
270
#if PY_MAJOR_VERSION >= 3
271
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
273
#else
274
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
276
#endif
277
#ifndef PySet_CheckExact
278
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
279
#endif
280
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
281
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
282
#if PY_MAJOR_VERSION >= 3
283
#define PyIntObject PyLongObject
284
#define PyInt_Type PyLong_Type
285
#define PyInt_Check(op) PyLong_Check(op)
286
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
287
#define PyInt_FromString PyLong_FromString
288
#define PyInt_FromUnicode PyLong_FromUnicode
289
#define PyInt_FromLong PyLong_FromLong
290
#define PyInt_FromSize_t PyLong_FromSize_t
291
#define PyInt_FromSsize_t PyLong_FromSsize_t
292
#define PyInt_AsLong PyLong_AsLong
293
#define PyInt_AS_LONG PyLong_AS_LONG
294
#define PyInt_AsSsize_t PyLong_AsSsize_t
295
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
296
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
297
#define PyNumber_Int PyNumber_Long
298
#endif
299
#if PY_MAJOR_VERSION >= 3
300
#define PyBoolObject PyLongObject
301
#endif
302
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303
#ifndef PyUnicode_InternFromString
304
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
305
#endif
306
#endif
307
#if PY_VERSION_HEX < 0x030200A4
308
typedef long Py_hash_t;
309
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
310
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
311
#else
312
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
314
#endif
315
#if PY_MAJOR_VERSION >= 3
316
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
317
#else
318
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
319
#endif
320
#if CYTHON_USE_ASYNC_SLOTS
321
#if PY_VERSION_HEX >= 0x030500B1
322
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
323
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
324
#else
325
typedef struct {
326
unaryfunc am_await;
327
unaryfunc am_aiter;
328
unaryfunc am_anext;
329
} __Pyx_PyAsyncMethodsStruct;
330
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
331
#endif
332
#else
333
#define __Pyx_PyType_AsAsync(obj) NULL
334
#endif
335
#ifndef CYTHON_RESTRICT
336
#if defined(__GNUC__)
337
#define CYTHON_RESTRICT __restrict__
338
#elif defined(_MSC_VER) && _MSC_VER >= 1400
339
#define CYTHON_RESTRICT __restrict
340
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341
#define CYTHON_RESTRICT restrict
342
#else
343
#define CYTHON_RESTRICT
344
#endif
345
#endif
346
#ifndef CYTHON_UNUSED
347
# if defined(__GNUC__)
348
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
349
# define CYTHON_UNUSED __attribute__ ((__unused__))
350
# else
351
# define CYTHON_UNUSED
352
# endif
353
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354
# define CYTHON_UNUSED __attribute__ ((__unused__))
355
# else
356
# define CYTHON_UNUSED
357
# endif
358
#endif
359
#ifndef CYTHON_MAYBE_UNUSED_VAR
360
# if defined(__cplusplus)
361
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
362
# else
363
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
364
# endif
365
#endif
366
#ifndef CYTHON_NCP_UNUSED
367
# if CYTHON_COMPILING_IN_CPYTHON
368
# define CYTHON_NCP_UNUSED
369
# else
370
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
371
# endif
372
#endif
373
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
374
375
#ifndef CYTHON_INLINE
376
#if defined(__clang__)
377
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
378
#elif defined(__GNUC__)
379
#define CYTHON_INLINE __inline__
380
#elif defined(_MSC_VER)
381
#define CYTHON_INLINE __inline
382
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
383
#define CYTHON_INLINE inline
384
#else
385
#define CYTHON_INLINE
386
#endif
387
#endif
388
389
#if defined(WIN32) || defined(MS_WINDOWS)
390
#define _USE_MATH_DEFINES
391
#endif
392
#include <math.h>
393
#ifdef NAN
394
#define __PYX_NAN() ((float) NAN)
395
#else
396
static CYTHON_INLINE float __PYX_NAN() {
397
float value;
398
memset(&value, 0xFF, sizeof(value));
399
return value;
400
}
401
#endif
402
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403
#define __Pyx_truncl trunc
404
#else
405
#define __Pyx_truncl truncl
406
#endif
407
408
409
#define __PYX_ERR(f_index, lineno, Ln_error) \
410
{ \
411
__pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
412
}
413
414
#if PY_MAJOR_VERSION >= 3
415
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
416
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
417
#else
418
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
419
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
420
#endif
421
422
#ifndef __PYX_EXTERN_C
423
#ifdef __cplusplus
424
#define __PYX_EXTERN_C extern "C"
425
#else
426
#define __PYX_EXTERN_C extern
427
#endif
428
#endif
429
430
#define __PYX_HAVE__code__alex__psage__psage__ellcurve__galrep__wrapper
431
#define __PYX_HAVE_API__code__alex__psage__psage__ellcurve__galrep__wrapper
432
#include "struct_signals.h"
433
#include "pxi.h"
434
#include <string.h>
435
#include <stdlib.h>
436
#include <stdio.h>
437
#include <math.h>
438
#include "gmp.h"
439
#include <stdint.h>
440
#include "longintrepr.h"
441
#include "sage/libs/ntl/ntlwrap.h"
442
#include "pythread.h"
443
#include "sage/misc/cython_metaclass.h"
444
#include "galrep.h"
445
#ifdef _OPENMP
446
#include <omp.h>
447
#endif /* _OPENMP */
448
449
#ifdef PYREX_WITHOUT_ASSERTIONS
450
#define CYTHON_WITHOUT_ASSERTIONS
451
#endif
452
453
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
454
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
455
456
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
457
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
458
#define __PYX_DEFAULT_STRING_ENCODING ""
459
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
460
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
461
#define __Pyx_uchar_cast(c) ((unsigned char)c)
462
#define __Pyx_long_cast(x) ((long)x)
463
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
464
(sizeof(type) < sizeof(Py_ssize_t)) ||\
465
(sizeof(type) > sizeof(Py_ssize_t) &&\
466
likely(v < (type)PY_SSIZE_T_MAX ||\
467
v == (type)PY_SSIZE_T_MAX) &&\
468
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
469
v == (type)PY_SSIZE_T_MIN))) ||\
470
(sizeof(type) == sizeof(Py_ssize_t) &&\
471
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
472
v == (type)PY_SSIZE_T_MAX))) )
473
#if defined (__cplusplus) && __cplusplus >= 201103L
474
#include <cstdlib>
475
#define __Pyx_sst_abs(value) std::abs(value)
476
#elif SIZEOF_INT >= SIZEOF_SIZE_T
477
#define __Pyx_sst_abs(value) abs(value)
478
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
479
#define __Pyx_sst_abs(value) labs(value)
480
#elif defined (_MSC_VER) && defined (_M_X64)
481
#define __Pyx_sst_abs(value) _abs64(value)
482
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
483
#define __Pyx_sst_abs(value) llabs(value)
484
#elif defined (__GNUC__)
485
#define __Pyx_sst_abs(value) __builtin_llabs(value)
486
#else
487
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
488
#endif
489
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
490
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
491
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
492
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
493
#define __Pyx_PyBytes_FromString PyBytes_FromString
494
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
495
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
496
#if PY_MAJOR_VERSION < 3
497
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
498
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
499
#else
500
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
501
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
502
#endif
503
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
504
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
505
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
506
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
507
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
508
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
509
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
510
#if PY_MAJOR_VERSION < 3
511
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
512
{
513
const Py_UNICODE *u_end = u;
514
while (*u_end++) ;
515
return (size_t)(u_end - u - 1);
516
}
517
#else
518
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
519
#endif
520
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
521
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
522
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
523
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
524
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
525
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
526
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
527
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
528
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
529
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
530
#if CYTHON_ASSUME_SAFE_MACROS
531
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
532
#else
533
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
534
#endif
535
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
536
#if PY_MAJOR_VERSION >= 3
537
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
538
#else
539
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
540
#endif
541
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
542
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
543
static int __Pyx_sys_getdefaultencoding_not_ascii;
544
static int __Pyx_init_sys_getdefaultencoding_params(void) {
545
PyObject* sys;
546
PyObject* default_encoding = NULL;
547
PyObject* ascii_chars_u = NULL;
548
PyObject* ascii_chars_b = NULL;
549
const char* default_encoding_c;
550
sys = PyImport_ImportModule("sys");
551
if (!sys) goto bad;
552
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
553
Py_DECREF(sys);
554
if (!default_encoding) goto bad;
555
default_encoding_c = PyBytes_AsString(default_encoding);
556
if (!default_encoding_c) goto bad;
557
if (strcmp(default_encoding_c, "ascii") == 0) {
558
__Pyx_sys_getdefaultencoding_not_ascii = 0;
559
} else {
560
char ascii_chars[128];
561
int c;
562
for (c = 0; c < 128; c++) {
563
ascii_chars[c] = c;
564
}
565
__Pyx_sys_getdefaultencoding_not_ascii = 1;
566
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
567
if (!ascii_chars_u) goto bad;
568
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
569
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
570
PyErr_Format(
571
PyExc_ValueError,
572
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
573
default_encoding_c);
574
goto bad;
575
}
576
Py_DECREF(ascii_chars_u);
577
Py_DECREF(ascii_chars_b);
578
}
579
Py_DECREF(default_encoding);
580
return 0;
581
bad:
582
Py_XDECREF(default_encoding);
583
Py_XDECREF(ascii_chars_u);
584
Py_XDECREF(ascii_chars_b);
585
return -1;
586
}
587
#endif
588
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
589
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
590
#else
591
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
592
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
593
static char* __PYX_DEFAULT_STRING_ENCODING;
594
static int __Pyx_init_sys_getdefaultencoding_params(void) {
595
PyObject* sys;
596
PyObject* default_encoding = NULL;
597
char* default_encoding_c;
598
sys = PyImport_ImportModule("sys");
599
if (!sys) goto bad;
600
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
601
Py_DECREF(sys);
602
if (!default_encoding) goto bad;
603
default_encoding_c = PyBytes_AsString(default_encoding);
604
if (!default_encoding_c) goto bad;
605
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
606
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
607
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
608
Py_DECREF(default_encoding);
609
return 0;
610
bad:
611
Py_XDECREF(default_encoding);
612
return -1;
613
}
614
#endif
615
#endif
616
617
618
/* Test for GCC > 2.95 */
619
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
620
#define likely(x) __builtin_expect(!!(x), 1)
621
#define unlikely(x) __builtin_expect(!!(x), 0)
622
#else /* !__GNUC__ or GCC < 2.95 */
623
#define likely(x) (x)
624
#define unlikely(x) (x)
625
#endif /* __GNUC__ */
626
627
static PyObject *__pyx_m;
628
static PyObject *__pyx_d;
629
static PyObject *__pyx_b;
630
static PyObject *__pyx_empty_tuple;
631
static PyObject *__pyx_empty_bytes;
632
static PyObject *__pyx_empty_unicode;
633
static int __pyx_lineno;
634
static int __pyx_clineno = 0;
635
static const char * __pyx_cfilenm= __FILE__;
636
static const char *__pyx_filename;
637
638
639
static const char *__pyx_f[] = {
640
"code/alex/psage/psage/ellcurve/galrep/wrapper.pyx",
641
"element.pxd",
642
"memory.pxd",
643
"sage_object.pxd",
644
"stdsage.pxd",
645
"code/alex/psage/psage/ellcurve/galrep/stringsource",
646
"type.pxd",
647
"bool.pxd",
648
"complex.pxd",
649
"category_object.pxd",
650
"coerce_dict.pxd",
651
"parent.pxd",
652
"inherit_comparison.pxd",
653
"map.pxd",
654
"morphism.pxd",
655
"integer.pxd",
656
"signals.pxi",
657
"stdsage.pxi",
658
};
659
660
/*--- Type declarations ---*/
661
struct __pyx_obj_4sage_9structure_11sage_object_SageObject;
662
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject;
663
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict;
664
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict;
665
struct __pyx_obj_4sage_9structure_6parent_Parent;
666
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass;
667
struct __pyx_obj_4sage_9structure_7element_Element;
668
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod;
669
struct __pyx_obj_4sage_9structure_7element_ModuleElement;
670
struct __pyx_obj_4sage_9structure_7element_MonoidElement;
671
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement;
672
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement;
673
struct __pyx_obj_4sage_9structure_7element_RingElement;
674
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement;
675
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement;
676
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement;
677
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement;
678
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement;
679
struct __pyx_obj_4sage_9structure_7element_FieldElement;
680
struct __pyx_obj_4sage_9structure_7element_AlgebraElement;
681
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement;
682
struct __pyx_obj_4sage_9structure_7element_InfinityElement;
683
struct __pyx_obj_4sage_9structure_7element_Vector;
684
struct __pyx_obj_4sage_9structure_7element_Matrix;
685
struct __pyx_obj_4sage_9structure_7element_CoercionModel;
686
struct __pyx_obj_4sage_10categories_3map_Map;
687
struct __pyx_obj_4sage_10categories_3map_Section;
688
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap;
689
struct __pyx_obj_4sage_10categories_8morphism_Morphism;
690
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism;
691
struct __pyx_obj_4sage_5rings_7integer_Integer;
692
struct __pyx_obj_4sage_5rings_7integer_int_to_Z;
693
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep;
694
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py;
695
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce;
696
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action;
697
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action;
698
699
/* "parent.pxd":102
700
*
701
* # Flags for Parent.flags
702
* cdef enum: # <<<<<<<<<<<<<<
703
* # If this flag is set, call __richcmp__ on elements without
704
* # coercion. This allows a completely custom comparison function.
705
*/
706
enum {
707
__pyx_e_4sage_9structure_6parent_Parent_richcmp_element_without_coercion = 1
708
};
709
710
/* "parent.pxd":38
711
*
712
* # Called from the __init__ method to set up coercion.
713
* cdef int init_coerce(self, bint warn=*) except -1 # <<<<<<<<<<<<<<
714
*
715
* # returns whether or not there is a Morphism from S to self
716
*/
717
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce {
718
int __pyx_n;
719
int warn;
720
};
721
722
/* "parent.pxd":55
723
* # returns the Action by/on self on/by S
724
* # corresponding to op and self_on_left
725
* cpdef get_action(self, S, op=*, bint self_on_left=*, self_el=*, S_el=*) # <<<<<<<<<<<<<<
726
* cpdef _get_action_(self, S, op, bint self_on_left)
727
*
728
*/
729
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action {
730
int __pyx_n;
731
PyObject *op;
732
int self_on_left;
733
PyObject *self_el;
734
PyObject *S_el;
735
};
736
737
/* "parent.pxd":68
738
* cdef discover_coerce_map_from(self, S)
739
* cdef discover_convert_map_from(self, S)
740
* cdef discover_action(self, S, op, bint self_on_left, self_el=*, S_el=*) # <<<<<<<<<<<<<<
741
*
742
* # List consisting of Morphisms (from anything to self)
743
*/
744
struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action {
745
int __pyx_n;
746
PyObject *self_el;
747
PyObject *S_el;
748
};
749
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args;
750
751
/* "map.pxd":15
752
* # these methods require x is an element of domain, and returns an element with parent codomain
753
* cpdef Element _call_(self, x)
754
* cpdef Element _call_with_args(self, x, args=*, kwds=*) # <<<<<<<<<<<<<<
755
*
756
* cdef public domain # will be either a weakref or a constant map
757
*/
758
struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args {
759
int __pyx_n;
760
PyObject *args;
761
PyObject *kwds;
762
};
763
764
/* "sage_object.pxd":9
765
*
766
*
767
* cdef class SageObject: # <<<<<<<<<<<<<<
768
* pass
769
*
770
*/
771
struct __pyx_obj_4sage_9structure_11sage_object_SageObject {
772
PyObject_HEAD
773
};
774
775
776
/* "sage/structure/category_object.pxd":15
777
* cpdef check_default_category(default_category, category)
778
*
779
* cdef class CategoryObject(SageObject): # <<<<<<<<<<<<<<
780
* cdef public dict __cached_methods
781
* cdef _category
782
*/
783
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject {
784
struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
785
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtab;
786
PyObject *__cached_methods;
787
PyObject *_category;
788
PyObject *_base;
789
PyObject *_names;
790
PyObject *_factory_data;
791
PyObject *__weakref__;
792
long _hash_value;
793
};
794
795
796
/* "sage/structure/coerce_dict.pxd":7
797
*
798
* @cython.final
799
* cdef class MonoDict: # <<<<<<<<<<<<<<
800
* cdef __weakref__
801
* cdef size_t mask
802
*/
803
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict {
804
PyObject_HEAD
805
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtab;
806
PyObject *__weakref__;
807
size_t mask;
808
size_t used;
809
size_t fill;
810
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *table;
811
int weak_values;
812
PyObject *eraser;
813
};
814
815
816
/* "sage/structure/coerce_dict.pxd":23
817
*
818
* @cython.final
819
* cdef class TripleDict: # <<<<<<<<<<<<<<
820
* cdef __weakref__
821
* cdef size_t mask
822
*/
823
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict {
824
PyObject_HEAD
825
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtab;
826
PyObject *__weakref__;
827
size_t mask;
828
size_t used;
829
size_t fill;
830
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *table;
831
int weak_values;
832
PyObject *eraser;
833
};
834
835
836
/* "parent.pxd":12
837
* from sage.structure.coerce_dict cimport MonoDict, TripleDict
838
*
839
* cdef class Parent(category_object.CategoryObject): # <<<<<<<<<<<<<<
840
* cdef public _element_constructor
841
* cdef public _convert_method_name
842
*/
843
struct __pyx_obj_4sage_9structure_6parent_Parent {
844
struct __pyx_obj_4sage_9structure_15category_object_CategoryObject __pyx_base;
845
PyObject *_element_constructor;
846
PyObject *_convert_method_name;
847
int _element_init_pass_parent;
848
PyObject *_initial_coerce_list;
849
PyObject *_initial_action_list;
850
PyObject *_initial_convert_list;
851
int _coercions_used;
852
int flags;
853
PyObject *_cache_an_element;
854
PyObject *_coerce_from_list;
855
PyObject *_registered_domains;
856
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_coerce_from_hash;
857
PyObject *_action_list;
858
struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *_action_hash;
859
PyObject *_convert_from_list;
860
struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *_convert_from_hash;
861
PyObject *_embedding;
862
};
863
864
865
/* "sage/misc/inherit_comparison.pxd":3
866
* cimport sage.misc.cython_metaclass
867
*
868
* cdef class InheritComparisonMetaclass(type): # <<<<<<<<<<<<<<
869
* pass
870
*/
871
struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass {
872
PyHeapTypeObject __pyx_base;
873
};
874
875
876
/* "sage/structure/element.pxd":169
877
*
878
*
879
* cdef class Element(SageObject): # <<<<<<<<<<<<<<
880
* cdef Parent _parent
881
* cpdef _richcmp_(left, right, int op)
882
*/
883
struct __pyx_obj_4sage_9structure_7element_Element {
884
struct __pyx_obj_4sage_9structure_11sage_object_SageObject __pyx_base;
885
struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtab;
886
struct __pyx_obj_4sage_9structure_6parent_Parent *_parent;
887
};
888
889
890
/* "sage/structure/element.pxd":192
891
*
892
*
893
* cdef class ElementWithCachedMethod(Element): # <<<<<<<<<<<<<<
894
* cdef public dict __cached_methods
895
*
896
*/
897
struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod {
898
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
899
PyObject *__cached_methods;
900
};
901
902
903
/* "sage/structure/element.pxd":195
904
* cdef public dict __cached_methods
905
*
906
* cdef class ModuleElement(Element) # forward declaration # <<<<<<<<<<<<<<
907
*
908
* cdef class RingElement(ModuleElement) # forward declaration
909
*/
910
struct __pyx_obj_4sage_9structure_7element_ModuleElement {
911
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
912
};
913
914
915
/* "sage/structure/element.pxd":208
916
* cpdef _rmul_(self, RingElement left)
917
*
918
* cdef class MonoidElement(Element): # <<<<<<<<<<<<<<
919
* pass
920
*
921
*/
922
struct __pyx_obj_4sage_9structure_7element_MonoidElement {
923
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
924
};
925
926
927
/* "sage/structure/element.pxd":211
928
* pass
929
*
930
* cdef class MultiplicativeGroupElement(MonoidElement): # <<<<<<<<<<<<<<
931
* cpdef _div_(self, right)
932
*
933
*/
934
struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement {
935
struct __pyx_obj_4sage_9structure_7element_MonoidElement __pyx_base;
936
};
937
938
939
/* "sage/structure/element.pxd":214
940
* cpdef _div_(self, right)
941
*
942
* cdef class AdditiveGroupElement(ModuleElement): # <<<<<<<<<<<<<<
943
* pass
944
*
945
*/
946
struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement {
947
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
948
};
949
950
951
/* "sage/structure/element.pxd":197
952
* cdef class ModuleElement(Element) # forward declaration
953
*
954
* cdef class RingElement(ModuleElement) # forward declaration # <<<<<<<<<<<<<<
955
*
956
* cdef class ModuleElement(Element):
957
*/
958
struct __pyx_obj_4sage_9structure_7element_RingElement {
959
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
960
};
961
962
963
/* "sage/structure/element.pxd":220
964
* cpdef _div_(self, right)
965
*
966
* cdef class CommutativeRingElement(RingElement): # <<<<<<<<<<<<<<
967
* pass
968
*
969
*/
970
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement {
971
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
972
};
973
974
975
/* "sage/structure/element.pxd":223
976
* pass
977
*
978
* cdef class IntegralDomainElement(CommutativeRingElement): # <<<<<<<<<<<<<<
979
* pass
980
*
981
*/
982
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement {
983
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
984
};
985
986
987
/* "sage/structure/element.pxd":226
988
* pass
989
*
990
* cdef class DedekindDomainElement(IntegralDomainElement): # <<<<<<<<<<<<<<
991
* pass
992
*
993
*/
994
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement {
995
struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement __pyx_base;
996
};
997
998
999
/* "sage/structure/element.pxd":229
1000
* pass
1001
*
1002
* cdef class PrincipalIdealDomainElement(DedekindDomainElement): # <<<<<<<<<<<<<<
1003
* pass
1004
*
1005
*/
1006
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement {
1007
struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement __pyx_base;
1008
};
1009
1010
1011
/* "sage/structure/element.pxd":232
1012
* pass
1013
*
1014
* cdef class EuclideanDomainElement(PrincipalIdealDomainElement): # <<<<<<<<<<<<<<
1015
* cpdef _floordiv_(self, right)
1016
* cpdef _mod_(self, right)
1017
*/
1018
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement {
1019
struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
1020
};
1021
1022
1023
/* "sage/structure/element.pxd":236
1024
* cpdef _mod_(self, right)
1025
*
1026
* cdef class FieldElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1027
* cpdef _floordiv_(self, right)
1028
*
1029
*/
1030
struct __pyx_obj_4sage_9structure_7element_FieldElement {
1031
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1032
};
1033
1034
1035
/* "sage/structure/element.pxd":239
1036
* cpdef _floordiv_(self, right)
1037
*
1038
* cdef class AlgebraElement(RingElement): # <<<<<<<<<<<<<<
1039
* pass
1040
*
1041
*/
1042
struct __pyx_obj_4sage_9structure_7element_AlgebraElement {
1043
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1044
};
1045
1046
1047
/* "sage/structure/element.pxd":242
1048
* pass
1049
*
1050
* cdef class CommutativeAlgebraElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1051
* pass
1052
*
1053
*/
1054
struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement {
1055
struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1056
};
1057
1058
1059
/* "sage/structure/element.pxd":245
1060
* pass
1061
*
1062
* cdef class InfinityElement(RingElement): # <<<<<<<<<<<<<<
1063
* pass
1064
*
1065
*/
1066
struct __pyx_obj_4sage_9structure_7element_InfinityElement {
1067
struct __pyx_obj_4sage_9structure_7element_RingElement __pyx_base;
1068
};
1069
1070
1071
/* "sage/structure/element.pxd":249
1072
*
1073
*
1074
* cdef class Vector(ModuleElement): # <<<<<<<<<<<<<<
1075
* cdef Py_ssize_t _degree
1076
*
1077
*/
1078
struct __pyx_obj_4sage_9structure_7element_Vector {
1079
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1080
Py_ssize_t _degree;
1081
};
1082
1083
1084
/* "sage/structure/element.pxd":264
1085
*
1086
*
1087
* cdef class Matrix(ModuleElement): # <<<<<<<<<<<<<<
1088
* # All matrix classes must be written in Cython
1089
* cdef Py_ssize_t _nrows
1090
*/
1091
struct __pyx_obj_4sage_9structure_7element_Matrix {
1092
struct __pyx_obj_4sage_9structure_7element_ModuleElement __pyx_base;
1093
Py_ssize_t _nrows;
1094
Py_ssize_t _ncols;
1095
};
1096
1097
1098
/* "sage/structure/element.pxd":277
1099
*
1100
*
1101
* cdef class CoercionModel: # <<<<<<<<<<<<<<
1102
* cpdef canonical_coercion(self, x, y)
1103
* cpdef bin_op(self, x, y, op)
1104
*/
1105
struct __pyx_obj_4sage_9structure_7element_CoercionModel {
1106
PyObject_HEAD
1107
struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel *__pyx_vtab;
1108
};
1109
1110
1111
/* "map.pxd":4
1112
* from sage.structure.element cimport Element
1113
*
1114
* cdef class Map(Element): # <<<<<<<<<<<<<<
1115
* cdef object __weakref__
1116
*
1117
*/
1118
struct __pyx_obj_4sage_10categories_3map_Map {
1119
struct __pyx_obj_4sage_9structure_7element_Element __pyx_base;
1120
PyObject *__weakref__;
1121
int _coerce_cost;
1122
PyObject *domain;
1123
PyObject *codomain;
1124
struct __pyx_obj_4sage_9structure_6parent_Parent *_codomain;
1125
PyObject *_category_for;
1126
PyObject *_repr_type_str;
1127
};
1128
1129
1130
/* "map.pxd":25
1131
*
1132
*
1133
* cdef class Section(Map): # <<<<<<<<<<<<<<
1134
* cdef Map _inverse
1135
*
1136
*/
1137
struct __pyx_obj_4sage_10categories_3map_Section {
1138
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1139
struct __pyx_obj_4sage_10categories_3map_Map *_inverse;
1140
};
1141
1142
1143
/* "map.pxd":28
1144
* cdef Map _inverse
1145
*
1146
* cdef class FormalCompositeMap(Map): # <<<<<<<<<<<<<<
1147
* cdef __list
1148
*/
1149
struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap {
1150
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1151
PyObject *__pyx___list;
1152
};
1153
1154
1155
/* "sage/categories/morphism.pxd":5
1156
* from .map cimport Map
1157
*
1158
* cdef class Morphism(Map): # <<<<<<<<<<<<<<
1159
* pass
1160
*
1161
*/
1162
struct __pyx_obj_4sage_10categories_8morphism_Morphism {
1163
struct __pyx_obj_4sage_10categories_3map_Map __pyx_base;
1164
};
1165
1166
1167
/* "sage/categories/morphism.pxd":8
1168
* pass
1169
*
1170
* cdef class SetMorphism(Morphism): # <<<<<<<<<<<<<<
1171
* cdef object _function
1172
* cpdef bint _eq_c_impl(left, Element right)
1173
*/
1174
struct __pyx_obj_4sage_10categories_8morphism_SetMorphism {
1175
struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
1176
PyObject *_function;
1177
};
1178
1179
1180
/* "sage/rings/integer.pxd":7
1181
* from sage.categories.morphism cimport Morphism
1182
*
1183
* cdef class Integer(EuclideanDomainElement): # <<<<<<<<<<<<<<
1184
* cdef mpz_t value
1185
*
1186
*/
1187
struct __pyx_obj_4sage_5rings_7integer_Integer {
1188
struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
1189
mpz_t value;
1190
};
1191
1192
1193
/* "sage/rings/integer.pxd":37
1194
* cdef Integer smallInteger(long value)
1195
*
1196
* cdef class int_to_Z(Morphism): # <<<<<<<<<<<<<<
1197
* pass
1198
*/
1199
struct __pyx_obj_4sage_5rings_7integer_int_to_Z {
1200
struct __pyx_obj_4sage_10categories_8morphism_Morphism __pyx_base;
1201
};
1202
1203
1204
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":49
1205
* # only used for providing an API for some functions.
1206
*
1207
* cdef class GalRep: # <<<<<<<<<<<<<<
1208
* """
1209
* Andrew Sutherland's Probabilistic Image of Galois Algorithm
1210
*/
1211
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep {
1212
PyObject_HEAD
1213
PyObject *primes;
1214
};
1215
1216
1217
/* "cfunc.to_py":64
1218
*
1219
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
1220
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
1221
* def wrap(object arg0, object arg1, int arg2):
1222
* """wrap(arg0, arg1, arg2: 'int')"""
1223
*/
1224
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py {
1225
PyObject_HEAD
1226
PyObject *(*__pyx_v_f)(PyObject *, PyObject *, int);
1227
};
1228
1229
1230
1231
/* "sage/structure/category_object.pxd":15
1232
* cpdef check_default_category(default_category, category)
1233
*
1234
* cdef class CategoryObject(SageObject): # <<<<<<<<<<<<<<
1235
* cdef public dict __cached_methods
1236
* cdef _category
1237
*/
1238
1239
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject {
1240
PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject *, PyObject *);
1241
};
1242
static struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject *__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject;
1243
1244
1245
/* "sage/structure/coerce_dict.pxd":7
1246
*
1247
* @cython.final
1248
* cdef class MonoDict: # <<<<<<<<<<<<<<
1249
* cdef __weakref__
1250
* cdef size_t mask
1251
*/
1252
1253
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict {
1254
struct __pyx_t_4sage_9structure_11coerce_dict_mono_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
1255
PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *);
1256
PyObject *(*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *, PyObject *, PyObject *);
1257
int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict *);
1258
};
1259
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict;
1260
1261
1262
/* "sage/structure/coerce_dict.pxd":23
1263
*
1264
* @cython.final
1265
* cdef class TripleDict: # <<<<<<<<<<<<<<
1266
* cdef __weakref__
1267
* cdef size_t mask
1268
*/
1269
1270
struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict {
1271
struct __pyx_t_4sage_9structure_11coerce_dict_triple_cell *(*lookup)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
1272
PyObject *(*get)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *);
1273
PyObject *(*set)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *, PyObject *, PyObject *, PyObject *, PyObject *);
1274
int (*resize)(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict *);
1275
};
1276
static struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict *__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict;
1277
1278
1279
/* "parent.pxd":12
1280
* from sage.structure.coerce_dict cimport MonoDict, TripleDict
1281
*
1282
* cdef class Parent(category_object.CategoryObject): # <<<<<<<<<<<<<<
1283
* cdef public _element_constructor
1284
* cdef public _convert_method_name
1285
*/
1286
1287
struct __pyx_vtabstruct_4sage_9structure_6parent_Parent {
1288
struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject __pyx_base;
1289
int (*get_flag)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
1290
int (*is_coercion_cached)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1291
int (*is_conversion_cached)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1292
PyObject *(*register_coercion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1293
PyObject *(*register_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1294
PyObject *(*register_conversion)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1295
PyObject *(*register_embedding)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1296
int (*_richcmp)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int, int __pyx_skip_dispatch);
1297
int (*_cmp_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1298
int (*is_exact)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
1299
int (*init_coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_init_coerce *__pyx_optional_args);
1300
int (*has_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1301
PyObject *(*coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1302
PyObject *(*_internal_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1303
PyObject *(*_coerce_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1304
PyObject *(*convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1305
PyObject *(*_internal_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1306
PyObject *(*_convert_map_from_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1307
PyObject *(*get_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_get_action *__pyx_optional_args);
1308
PyObject *(*_get_action_)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
1309
PyObject *(*coerce)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1310
PyObject *(*an_element)(struct __pyx_obj_4sage_9structure_6parent_Parent *, int __pyx_skip_dispatch);
1311
PyObject *(*_generic_convert_map)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, int __pyx_skip_dispatch);
1312
PyObject *(*discover_coerce_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
1313
PyObject *(*discover_convert_map_from)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *);
1314
PyObject *(*discover_action)(struct __pyx_obj_4sage_9structure_6parent_Parent *, PyObject *, PyObject *, int, struct __pyx_opt_args_4sage_9structure_6parent_6Parent_discover_action *__pyx_optional_args);
1315
};
1316
static struct __pyx_vtabstruct_4sage_9structure_6parent_Parent *__pyx_vtabptr_4sage_9structure_6parent_Parent;
1317
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *, int);
1318
1319
1320
/* "sage/structure/element.pxd":169
1321
*
1322
*
1323
* cdef class Element(SageObject): # <<<<<<<<<<<<<<
1324
* cdef Parent _parent
1325
* cpdef _richcmp_(left, right, int op)
1326
*/
1327
1328
struct __pyx_vtabstruct_4sage_9structure_7element_Element {
1329
PyObject *(*_richcmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1330
int (*_cmp_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
1331
PyObject *(*base_extend)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int __pyx_skip_dispatch);
1332
PyObject *(*getattr_from_category)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1333
PyObject *(*_act_on_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1334
PyObject *(*_acted_upon_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *, int, int __pyx_skip_dispatch);
1335
PyObject *(*_add_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1336
PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1337
PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_Element *);
1338
PyObject *(*_add_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
1339
PyObject *(*_mul_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1340
PyObject *(*_mul_long)(struct __pyx_obj_4sage_9structure_7element_Element *, long);
1341
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1342
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1343
PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_Element *, PyObject *);
1344
};
1345
static struct __pyx_vtabstruct_4sage_9structure_7element_Element *__pyx_vtabptr_4sage_9structure_7element_Element;
1346
1347
1348
/* "sage/structure/element.pxd":192
1349
*
1350
*
1351
* cdef class ElementWithCachedMethod(Element): # <<<<<<<<<<<<<<
1352
* cdef public dict __cached_methods
1353
*
1354
*/
1355
1356
struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod {
1357
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1358
};
1359
static struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod *__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod;
1360
1361
1362
/* "sage/structure/element.pxd":195
1363
* cdef public dict __cached_methods
1364
*
1365
* cdef class ModuleElement(Element) # forward declaration # <<<<<<<<<<<<<<
1366
*
1367
* cdef class RingElement(ModuleElement) # forward declaration
1368
*/
1369
1370
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement {
1371
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1372
PyObject *(*_sub_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, PyObject *, int __pyx_skip_dispatch);
1373
PyObject *(*_neg_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, int __pyx_skip_dispatch);
1374
PyObject *(*_lmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_RingElement *, int __pyx_skip_dispatch);
1375
PyObject *(*_rmul_)(struct __pyx_obj_4sage_9structure_7element_ModuleElement *, struct __pyx_obj_4sage_9structure_7element_RingElement *, int __pyx_skip_dispatch);
1376
};
1377
static struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement *__pyx_vtabptr_4sage_9structure_7element_ModuleElement;
1378
1379
1380
/* "sage/structure/element.pxd":197
1381
* cdef class ModuleElement(Element) # forward declaration
1382
*
1383
* cdef class RingElement(ModuleElement) # forward declaration # <<<<<<<<<<<<<<
1384
*
1385
* cdef class ModuleElement(Element):
1386
*/
1387
1388
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement {
1389
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
1390
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_RingElement *, PyObject *, int __pyx_skip_dispatch);
1391
};
1392
static struct __pyx_vtabstruct_4sage_9structure_7element_RingElement *__pyx_vtabptr_4sage_9structure_7element_RingElement;
1393
1394
1395
/* "sage/structure/element.pxd":208
1396
* cpdef _rmul_(self, RingElement left)
1397
*
1398
* cdef class MonoidElement(Element): # <<<<<<<<<<<<<<
1399
* pass
1400
*
1401
*/
1402
1403
struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement {
1404
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1405
};
1406
static struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement *__pyx_vtabptr_4sage_9structure_7element_MonoidElement;
1407
1408
1409
/* "sage/structure/element.pxd":211
1410
* pass
1411
*
1412
* cdef class MultiplicativeGroupElement(MonoidElement): # <<<<<<<<<<<<<<
1413
* cpdef _div_(self, right)
1414
*
1415
*/
1416
1417
struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement {
1418
struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement __pyx_base;
1419
PyObject *(*_div_)(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement *, PyObject *, int __pyx_skip_dispatch);
1420
};
1421
static struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement *__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement;
1422
1423
1424
/* "sage/structure/element.pxd":214
1425
* cpdef _div_(self, right)
1426
*
1427
* cdef class AdditiveGroupElement(ModuleElement): # <<<<<<<<<<<<<<
1428
* pass
1429
*
1430
*/
1431
1432
struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement {
1433
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
1434
};
1435
static struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement *__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement;
1436
1437
1438
/* "sage/structure/element.pxd":220
1439
* cpdef _div_(self, right)
1440
*
1441
* cdef class CommutativeRingElement(RingElement): # <<<<<<<<<<<<<<
1442
* pass
1443
*
1444
*/
1445
1446
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement {
1447
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
1448
};
1449
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement;
1450
1451
1452
/* "sage/structure/element.pxd":223
1453
* pass
1454
*
1455
* cdef class IntegralDomainElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1456
* pass
1457
*
1458
*/
1459
1460
struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement {
1461
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1462
};
1463
static struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement *__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement;
1464
1465
1466
/* "sage/structure/element.pxd":226
1467
* pass
1468
*
1469
* cdef class DedekindDomainElement(IntegralDomainElement): # <<<<<<<<<<<<<<
1470
* pass
1471
*
1472
*/
1473
1474
struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement {
1475
struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement __pyx_base;
1476
};
1477
static struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement *__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement;
1478
1479
1480
/* "sage/structure/element.pxd":229
1481
* pass
1482
*
1483
* cdef class PrincipalIdealDomainElement(DedekindDomainElement): # <<<<<<<<<<<<<<
1484
* pass
1485
*
1486
*/
1487
1488
struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement {
1489
struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement __pyx_base;
1490
};
1491
static struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement *__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement;
1492
1493
1494
/* "sage/structure/element.pxd":232
1495
* pass
1496
*
1497
* cdef class EuclideanDomainElement(PrincipalIdealDomainElement): # <<<<<<<<<<<<<<
1498
* cpdef _floordiv_(self, right)
1499
* cpdef _mod_(self, right)
1500
*/
1501
1502
struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement {
1503
struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement __pyx_base;
1504
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
1505
PyObject *(*_mod_)(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement *, PyObject *, int __pyx_skip_dispatch);
1506
};
1507
static struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement *__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement;
1508
1509
1510
/* "sage/structure/element.pxd":236
1511
* cpdef _mod_(self, right)
1512
*
1513
* cdef class FieldElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1514
* cpdef _floordiv_(self, right)
1515
*
1516
*/
1517
1518
struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement {
1519
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1520
PyObject *(*_floordiv_)(struct __pyx_obj_4sage_9structure_7element_FieldElement *, PyObject *, int __pyx_skip_dispatch);
1521
};
1522
static struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement *__pyx_vtabptr_4sage_9structure_7element_FieldElement;
1523
1524
1525
/* "sage/structure/element.pxd":239
1526
* cpdef _floordiv_(self, right)
1527
*
1528
* cdef class AlgebraElement(RingElement): # <<<<<<<<<<<<<<
1529
* pass
1530
*
1531
*/
1532
1533
struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement {
1534
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
1535
};
1536
static struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement *__pyx_vtabptr_4sage_9structure_7element_AlgebraElement;
1537
1538
1539
/* "sage/structure/element.pxd":242
1540
* pass
1541
*
1542
* cdef class CommutativeAlgebraElement(CommutativeRingElement): # <<<<<<<<<<<<<<
1543
* pass
1544
*
1545
*/
1546
1547
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement {
1548
struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement __pyx_base;
1549
};
1550
static struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement *__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement;
1551
1552
1553
/* "sage/structure/element.pxd":245
1554
* pass
1555
*
1556
* cdef class InfinityElement(RingElement): # <<<<<<<<<<<<<<
1557
* pass
1558
*
1559
*/
1560
1561
struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement {
1562
struct __pyx_vtabstruct_4sage_9structure_7element_RingElement __pyx_base;
1563
};
1564
static struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement *__pyx_vtabptr_4sage_9structure_7element_InfinityElement;
1565
1566
1567
/* "sage/structure/element.pxd":249
1568
*
1569
*
1570
* cdef class Vector(ModuleElement): # <<<<<<<<<<<<<<
1571
* cdef Py_ssize_t _degree
1572
*
1573
*/
1574
1575
struct __pyx_vtabstruct_4sage_9structure_7element_Vector {
1576
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
1577
PyObject *(*_dot_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
1578
PyObject *(*_dot_product_coerce_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
1579
PyObject *(*_pairwise_product_)(struct __pyx_obj_4sage_9structure_7element_Vector *, struct __pyx_obj_4sage_9structure_7element_Vector *, int __pyx_skip_dispatch);
1580
int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
1581
int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Vector *);
1582
};
1583
static struct __pyx_vtabstruct_4sage_9structure_7element_Vector *__pyx_vtabptr_4sage_9structure_7element_Vector;
1584
1585
1586
/* "sage/structure/element.pxd":264
1587
*
1588
*
1589
* cdef class Matrix(ModuleElement): # <<<<<<<<<<<<<<
1590
* # All matrix classes must be written in Cython
1591
* cdef Py_ssize_t _nrows
1592
*/
1593
1594
struct __pyx_vtabstruct_4sage_9structure_7element_Matrix {
1595
struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement __pyx_base;
1596
PyObject *(*_vector_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
1597
PyObject *(*_matrix_times_vector_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Vector *);
1598
PyObject *(*_matrix_times_matrix_)(struct __pyx_obj_4sage_9structure_7element_Matrix *, struct __pyx_obj_4sage_9structure_7element_Matrix *);
1599
int (*is_sparse_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
1600
int (*is_dense_c)(struct __pyx_obj_4sage_9structure_7element_Matrix *);
1601
};
1602
static struct __pyx_vtabstruct_4sage_9structure_7element_Matrix *__pyx_vtabptr_4sage_9structure_7element_Matrix;
1603
1604
1605
/* "sage/structure/element.pxd":277
1606
*
1607
*
1608
* cdef class CoercionModel: # <<<<<<<<<<<<<<
1609
* cpdef canonical_coercion(self, x, y)
1610
* cpdef bin_op(self, x, y, op)
1611
*/
1612
1613
struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel {
1614
PyObject *(*canonical_coercion)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, int __pyx_skip_dispatch);
1615
PyObject *(*bin_op)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
1616
PyObject *(*richcmp)(struct __pyx_obj_4sage_9structure_7element_CoercionModel *, PyObject *, PyObject *, int, int __pyx_skip_dispatch);
1617
};
1618
static struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel *__pyx_vtabptr_4sage_9structure_7element_CoercionModel;
1619
1620
1621
/* "map.pxd":4
1622
* from sage.structure.element cimport Element
1623
*
1624
* cdef class Map(Element): # <<<<<<<<<<<<<<
1625
* cdef object __weakref__
1626
*
1627
*/
1628
1629
struct __pyx_vtabstruct_4sage_10categories_3map_Map {
1630
struct __pyx_vtabstruct_4sage_9structure_7element_Element __pyx_base;
1631
PyObject *(*_update_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
1632
PyObject *(*_extra_slots)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *);
1633
struct __pyx_obj_4sage_9structure_7element_Element *(*_call_)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch);
1634
struct __pyx_obj_4sage_9structure_7element_Element *(*_call_with_args)(struct __pyx_obj_4sage_10categories_3map_Map *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_4sage_10categories_3map_3Map__call_with_args *__pyx_optional_args);
1635
};
1636
static struct __pyx_vtabstruct_4sage_10categories_3map_Map *__pyx_vtabptr_4sage_10categories_3map_Map;
1637
1638
1639
/* "map.pxd":25
1640
*
1641
*
1642
* cdef class Section(Map): # <<<<<<<<<<<<<<
1643
* cdef Map _inverse
1644
*
1645
*/
1646
1647
struct __pyx_vtabstruct_4sage_10categories_3map_Section {
1648
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
1649
};
1650
static struct __pyx_vtabstruct_4sage_10categories_3map_Section *__pyx_vtabptr_4sage_10categories_3map_Section;
1651
1652
1653
/* "map.pxd":28
1654
* cdef Map _inverse
1655
*
1656
* cdef class FormalCompositeMap(Map): # <<<<<<<<<<<<<<
1657
* cdef __list
1658
*/
1659
1660
struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap {
1661
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
1662
};
1663
static struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap *__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap;
1664
1665
1666
/* "sage/categories/morphism.pxd":5
1667
* from .map cimport Map
1668
*
1669
* cdef class Morphism(Map): # <<<<<<<<<<<<<<
1670
* pass
1671
*
1672
*/
1673
1674
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism {
1675
struct __pyx_vtabstruct_4sage_10categories_3map_Map __pyx_base;
1676
};
1677
static struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism *__pyx_vtabptr_4sage_10categories_8morphism_Morphism;
1678
1679
1680
/* "sage/categories/morphism.pxd":8
1681
* pass
1682
*
1683
* cdef class SetMorphism(Morphism): # <<<<<<<<<<<<<<
1684
* cdef object _function
1685
* cpdef bint _eq_c_impl(left, Element right)
1686
*/
1687
1688
struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism {
1689
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
1690
int (*_eq_c_impl)(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism *, struct __pyx_obj_4sage_9structure_7element_Element *, int __pyx_skip_dispatch);
1691
};
1692
static struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism *__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism;
1693
1694
1695
/* "sage/rings/integer.pxd":7
1696
* from sage.categories.morphism cimport Morphism
1697
*
1698
* cdef class Integer(EuclideanDomainElement): # <<<<<<<<<<<<<<
1699
* cdef mpz_t value
1700
*
1701
*/
1702
1703
struct __pyx_vtabstruct_4sage_5rings_7integer_Integer {
1704
struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement __pyx_base;
1705
int (*_to_ZZ)(struct __pyx_obj_4sage_5rings_7integer_Integer *, ZZ *);
1706
void (*set_from_mpz)(struct __pyx_obj_4sage_5rings_7integer_Integer *, __mpz_struct *);
1707
PyObject *(*hash_c)(struct __pyx_obj_4sage_5rings_7integer_Integer *);
1708
PyObject *(*_pari_)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
1709
PyObject *(*_shift_helper)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int, int __pyx_skip_dispatch);
1710
PyObject *(*_and)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
1711
PyObject *(*_or)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
1712
PyObject *(*_xor)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
1713
size_t (*_exact_log_log2_iter)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
1714
size_t (*_exact_log_mpfi_log)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *, int __pyx_skip_dispatch);
1715
struct __pyx_obj_4sage_9structure_7element_RingElement *(*_valuation)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
1716
PyObject *(*_val_unit)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
1717
struct __pyx_obj_4sage_5rings_7integer_Integer *(*_divide_knowing_divisible_by)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
1718
int (*_is_power_of)(struct __pyx_obj_4sage_5rings_7integer_Integer *, struct __pyx_obj_4sage_5rings_7integer_Integer *);
1719
int (*_pseudoprime_is_prime)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
1720
PyObject *(*_pari_divisors_small)(struct __pyx_obj_4sage_5rings_7integer_Integer *, int __pyx_skip_dispatch);
1721
PyObject *(*_reduce_set)(struct __pyx_obj_4sage_5rings_7integer_Integer *, PyObject *);
1722
};
1723
static struct __pyx_vtabstruct_4sage_5rings_7integer_Integer *__pyx_vtabptr_4sage_5rings_7integer_Integer;
1724
1725
1726
/* "sage/rings/integer.pxd":37
1727
* cdef Integer smallInteger(long value)
1728
*
1729
* cdef class int_to_Z(Morphism): # <<<<<<<<<<<<<<
1730
* pass
1731
*/
1732
1733
struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z {
1734
struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism __pyx_base;
1735
};
1736
static struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z *__pyx_vtabptr_4sage_5rings_7integer_int_to_Z;
1737
1738
/* --- Runtime support code (head) --- */
1739
/* Refnanny.proto */
1740
#ifndef CYTHON_REFNANNY
1741
#define CYTHON_REFNANNY 0
1742
#endif
1743
#if CYTHON_REFNANNY
1744
typedef struct {
1745
void (*INCREF)(void*, PyObject*, int);
1746
void (*DECREF)(void*, PyObject*, int);
1747
void (*GOTREF)(void*, PyObject*, int);
1748
void (*GIVEREF)(void*, PyObject*, int);
1749
void* (*SetupContext)(const char*, int, const char*);
1750
void (*FinishContext)(void**);
1751
} __Pyx_RefNannyAPIStruct;
1752
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1753
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1754
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1755
#ifdef WITH_THREAD
1756
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
1757
if (acquire_gil) {\
1758
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1759
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1760
PyGILState_Release(__pyx_gilstate_save);\
1761
} else {\
1762
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1763
}
1764
#else
1765
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
1766
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1767
#endif
1768
#define __Pyx_RefNannyFinishContext()\
1769
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1770
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1771
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1772
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1773
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1774
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1775
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1776
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1777
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1778
#else
1779
#define __Pyx_RefNannyDeclarations
1780
#define __Pyx_RefNannySetupContext(name, acquire_gil)
1781
#define __Pyx_RefNannyFinishContext()
1782
#define __Pyx_INCREF(r) Py_INCREF(r)
1783
#define __Pyx_DECREF(r) Py_DECREF(r)
1784
#define __Pyx_GOTREF(r)
1785
#define __Pyx_GIVEREF(r)
1786
#define __Pyx_XINCREF(r) Py_XINCREF(r)
1787
#define __Pyx_XDECREF(r) Py_XDECREF(r)
1788
#define __Pyx_XGOTREF(r)
1789
#define __Pyx_XGIVEREF(r)
1790
#endif
1791
#define __Pyx_XDECREF_SET(r, v) do {\
1792
PyObject *tmp = (PyObject *) r;\
1793
r = v; __Pyx_XDECREF(tmp);\
1794
} while (0)
1795
#define __Pyx_DECREF_SET(r, v) do {\
1796
PyObject *tmp = (PyObject *) r;\
1797
r = v; __Pyx_DECREF(tmp);\
1798
} while (0)
1799
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1800
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1801
1802
/* PyObjectGetAttrStr.proto */
1803
#if CYTHON_USE_TYPE_SLOTS
1804
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
1805
PyTypeObject* tp = Py_TYPE(obj);
1806
if (likely(tp->tp_getattro))
1807
return tp->tp_getattro(obj, attr_name);
1808
#if PY_MAJOR_VERSION < 3
1809
if (likely(tp->tp_getattr))
1810
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
1811
#endif
1812
return PyObject_GetAttr(obj, attr_name);
1813
}
1814
#else
1815
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1816
#endif
1817
1818
/* GetBuiltinName.proto */
1819
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1820
1821
/* RaiseDoubleKeywords.proto */
1822
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1823
1824
/* ParseKeywords.proto */
1825
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1826
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1827
const char* function_name);
1828
1829
/* RaiseArgTupleInvalid.proto */
1830
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1831
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1832
1833
/* Import.proto */
1834
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1835
1836
/* GetModuleGlobalName.proto */
1837
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1838
1839
/* PyCFunctionFastCall.proto */
1840
#if CYTHON_FAST_PYCCALL
1841
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1842
#else
1843
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1844
#endif
1845
1846
/* PyFunctionFastCall.proto */
1847
#if CYTHON_FAST_PYCALL
1848
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1849
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1850
#if 1 || PY_VERSION_HEX < 0x030600B1
1851
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
1852
#else
1853
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1854
#endif
1855
#endif
1856
1857
/* PyObjectCall.proto */
1858
#if CYTHON_COMPILING_IN_CPYTHON
1859
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1860
#else
1861
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1862
#endif
1863
1864
/* PyObjectCallMethO.proto */
1865
#if CYTHON_COMPILING_IN_CPYTHON
1866
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1867
#endif
1868
1869
/* PyObjectCallOneArg.proto */
1870
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1871
1872
/* PyThreadStateGet.proto */
1873
#if CYTHON_FAST_THREAD_STATE
1874
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1875
#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
1876
#else
1877
#define __Pyx_PyThreadState_declare
1878
#define __Pyx_PyThreadState_assign
1879
#endif
1880
1881
/* PyErrFetchRestore.proto */
1882
#if CYTHON_FAST_THREAD_STATE
1883
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1884
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1885
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1886
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1887
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1888
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1889
#else
1890
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1891
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1892
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1893
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1894
#endif
1895
1896
/* RaiseException.proto */
1897
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1898
1899
/* ArgTypeTest.proto */
1900
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
1901
const char *name, int exact);
1902
1903
/* GetItemInt.proto */
1904
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1905
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1906
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1907
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1908
__Pyx_GetItemInt_Generic(o, to_py_func(i))))
1909
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1910
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1911
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1912
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1913
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1914
int wraparound, int boundscheck);
1915
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1916
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1917
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1918
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1919
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1920
int wraparound, int boundscheck);
1921
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1922
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1923
int is_list, int wraparound, int boundscheck);
1924
1925
/* ListAppend.proto */
1926
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1927
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1928
PyListObject* L = (PyListObject*) list;
1929
Py_ssize_t len = Py_SIZE(list);
1930
if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1931
Py_INCREF(x);
1932
PyList_SET_ITEM(list, len, x);
1933
Py_SIZE(list) = len+1;
1934
return 0;
1935
}
1936
return PyList_Append(list, x);
1937
}
1938
#else
1939
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1940
#endif
1941
1942
/* SaveResetException.proto */
1943
#if CYTHON_FAST_THREAD_STATE
1944
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1945
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1946
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1947
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1948
#else
1949
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1950
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1951
#endif
1952
1953
/* PyObjectCallNoArg.proto */
1954
#if CYTHON_COMPILING_IN_CPYTHON
1955
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1956
#else
1957
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1958
#endif
1959
1960
/* PyErrExceptionMatches.proto */
1961
#if CYTHON_FAST_THREAD_STATE
1962
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1963
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1964
#else
1965
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1966
#endif
1967
1968
/* GetException.proto */
1969
#if CYTHON_FAST_THREAD_STATE
1970
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1971
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1972
#else
1973
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1974
#endif
1975
1976
/* FetchCommonType.proto */
1977
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1978
1979
/* CythonFunction.proto */
1980
#define __Pyx_CyFunction_USED 1
1981
#include <structmember.h>
1982
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1983
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1984
#define __Pyx_CYFUNCTION_CCLASS 0x04
1985
#define __Pyx_CyFunction_GetClosure(f)\
1986
(((__pyx_CyFunctionObject *) (f))->func_closure)
1987
#define __Pyx_CyFunction_GetClassObj(f)\
1988
(((__pyx_CyFunctionObject *) (f))->func_classobj)
1989
#define __Pyx_CyFunction_Defaults(type, f)\
1990
((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1991
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1992
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1993
typedef struct {
1994
PyCFunctionObject func;
1995
#if PY_VERSION_HEX < 0x030500A0
1996
PyObject *func_weakreflist;
1997
#endif
1998
PyObject *func_dict;
1999
PyObject *func_name;
2000
PyObject *func_qualname;
2001
PyObject *func_doc;
2002
PyObject *func_globals;
2003
PyObject *func_code;
2004
PyObject *func_closure;
2005
PyObject *func_classobj;
2006
void *defaults;
2007
int defaults_pyobjects;
2008
int flags;
2009
PyObject *defaults_tuple;
2010
PyObject *defaults_kwdict;
2011
PyObject *(*defaults_getter)(PyObject *);
2012
PyObject *func_annotations;
2013
} __pyx_CyFunctionObject;
2014
static PyTypeObject *__pyx_CyFunctionType = 0;
2015
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
2016
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
2017
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
2018
int flags, PyObject* qualname,
2019
PyObject *self,
2020
PyObject *module, PyObject *globals,
2021
PyObject* code);
2022
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2023
size_t size,
2024
int pyobjects);
2025
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2026
PyObject *tuple);
2027
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2028
PyObject *dict);
2029
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2030
PyObject *dict);
2031
static int __pyx_CyFunction_init(void);
2032
2033
/* IncludeStringH.proto */
2034
#include <string.h>
2035
2036
/* GetVTable.proto */
2037
static void* __Pyx_GetVtable(PyObject *dict);
2038
2039
/* ImportFrom.proto */
2040
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2041
2042
/* CodeObjectCache.proto */
2043
typedef struct {
2044
PyCodeObject* code_object;
2045
int code_line;
2046
} __Pyx_CodeObjectCacheEntry;
2047
struct __Pyx_CodeObjectCache {
2048
int count;
2049
int max_count;
2050
__Pyx_CodeObjectCacheEntry* entries;
2051
};
2052
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2053
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2054
static PyCodeObject *__pyx_find_code_object(int code_line);
2055
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2056
2057
/* AddTraceback.proto */
2058
static void __Pyx_AddTraceback(const char *funcname, int c_line,
2059
int py_line, const char *filename);
2060
2061
/* CIntToPy.proto */
2062
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2063
2064
/* CIntFromPy.proto */
2065
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2066
2067
/* CIntToPy.proto */
2068
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2069
2070
/* CIntFromPy.proto */
2071
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2072
2073
/* CheckBinaryVersion.proto */
2074
static int __Pyx_check_binary_version(void);
2075
2076
/* PyIdentifierFromString.proto */
2077
#if !defined(__Pyx_PyIdentifier_FromString)
2078
#if PY_MAJOR_VERSION < 3
2079
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
2080
#else
2081
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
2082
#endif
2083
#endif
2084
2085
/* ModuleImport.proto */
2086
static PyObject *__Pyx_ImportModule(const char *name);
2087
2088
/* TypeImport.proto */
2089
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
2090
2091
/* VoidPtrImport.proto */
2092
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
2093
2094
/* InitStrings.proto */
2095
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2096
2097
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *__pyx_v_self, int __pyx_v_flag); /* proto*/
2098
2099
/* Module declarations from 'cysignals.__init__' */
2100
2101
/* Module declarations from 'cysignals' */
2102
2103
/* Module declarations from 'cysignals.signals' */
2104
static cysigs_t *__pyx_vp_9cysignals_7signals_cysigs = 0;
2105
#define cysigs (*__pyx_vp_9cysignals_7signals_cysigs)
2106
static void (*__pyx_f_9cysignals_7signals_print_backtrace)(void); /*proto*/
2107
static void (*__pyx_f_9cysignals_7signals__sig_on_interrupt_received)(void); /*proto*/
2108
static void (*__pyx_f_9cysignals_7signals__sig_on_recover)(void); /*proto*/
2109
static void (*__pyx_f_9cysignals_7signals__sig_off_warning)(char const *, int); /*proto*/
2110
2111
/* Module declarations from 'cython' */
2112
2113
/* Module declarations from 'libc.string' */
2114
2115
/* Module declarations from 'libc.stdlib' */
2116
2117
/* Module declarations from 'cysignals.memory' */
2118
static CYTHON_INLINE void *sig_malloc(size_t); /*proto*/
2119
static CYTHON_INLINE void *sig_realloc(void *, size_t); /*proto*/
2120
static CYTHON_INLINE void *sig_calloc(size_t, size_t); /*proto*/
2121
static CYTHON_INLINE void sig_free(void *); /*proto*/
2122
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t, size_t); /*proto*/
2123
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t, size_t); /*proto*/
2124
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *, size_t, size_t); /*proto*/
2125
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t); /*proto*/
2126
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *, size_t); /*proto*/
2127
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t, size_t); /*proto*/
2128
2129
/* Module declarations from 'libc.stdio' */
2130
2131
/* Module declarations from '__builtin__' */
2132
2133
/* Module declarations from 'cpython.type' */
2134
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2135
2136
/* Module declarations from 'cpython.version' */
2137
2138
/* Module declarations from 'cpython.ref' */
2139
2140
/* Module declarations from 'cpython.exc' */
2141
2142
/* Module declarations from 'cpython.module' */
2143
2144
/* Module declarations from 'cpython.mem' */
2145
2146
/* Module declarations from 'cpython.tuple' */
2147
2148
/* Module declarations from 'cpython.list' */
2149
2150
/* Module declarations from 'cpython.sequence' */
2151
2152
/* Module declarations from 'cpython.mapping' */
2153
2154
/* Module declarations from 'cpython.iterator' */
2155
2156
/* Module declarations from 'cpython.number' */
2157
2158
/* Module declarations from 'cpython.int' */
2159
2160
/* Module declarations from '__builtin__' */
2161
2162
/* Module declarations from 'cpython.bool' */
2163
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
2164
2165
/* Module declarations from 'cpython.long' */
2166
2167
/* Module declarations from 'cpython.float' */
2168
2169
/* Module declarations from '__builtin__' */
2170
2171
/* Module declarations from 'cpython.complex' */
2172
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
2173
2174
/* Module declarations from 'cpython.string' */
2175
2176
/* Module declarations from 'cpython.unicode' */
2177
2178
/* Module declarations from 'cpython.dict' */
2179
2180
/* Module declarations from 'cpython.instance' */
2181
2182
/* Module declarations from 'cpython.function' */
2183
2184
/* Module declarations from 'cpython.method' */
2185
2186
/* Module declarations from 'cpython.weakref' */
2187
2188
/* Module declarations from 'cpython.getargs' */
2189
2190
/* Module declarations from 'cpython.pythread' */
2191
2192
/* Module declarations from 'cpython.pystate' */
2193
2194
/* Module declarations from 'cpython.cobject' */
2195
2196
/* Module declarations from 'cpython.oldbuffer' */
2197
2198
/* Module declarations from 'cpython.set' */
2199
2200
/* Module declarations from 'cpython.buffer' */
2201
2202
/* Module declarations from 'cpython.bytes' */
2203
2204
/* Module declarations from 'cpython.pycapsule' */
2205
2206
/* Module declarations from 'cpython' */
2207
2208
/* Module declarations from 'cpython.object' */
2209
2210
/* Module declarations from 'sage.ext.stdsage' */
2211
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *); /*proto*/
2212
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *); /*proto*/
2213
2214
/* Module declarations from 'libc.math' */
2215
2216
/* Module declarations from 'sage.libs.gmp.types' */
2217
2218
/* Module declarations from 'sage.libs.gmp.random' */
2219
2220
/* Module declarations from 'libc.stdint' */
2221
2222
/* Module declarations from 'sage.libs.gmp.mpz' */
2223
2224
/* Module declarations from 'sage.libs.gmp.mpq' */
2225
2226
/* Module declarations from 'sage.libs.gmp.pylong' */
2227
2228
/* Module declarations from 'sage.libs.gmp.all' */
2229
2230
/* Module declarations from 'sage.libs.ntl.types' */
2231
2232
/* Module declarations from 'sage.structure.sage_object' */
2233
static PyTypeObject *__pyx_ptype_4sage_9structure_11sage_object_SageObject = 0;
2234
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(PyObject *, PyObject *, int, int __pyx_skip_dispatch); /*proto*/
2235
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool(int, int, int __pyx_skip_dispatch); /*proto*/
2236
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(int, int, int __pyx_skip_dispatch); /*proto*/
2237
2238
/* Module declarations from 'sage.structure.category_object' */
2239
static PyTypeObject *__pyx_ptype_4sage_9structure_15category_object_CategoryObject = 0;
2240
2241
/* Module declarations from 'sage.structure' */
2242
2243
/* Module declarations from 'sage.misc.cython_metaclass' */
2244
2245
/* Module declarations from 'sage.misc' */
2246
2247
/* Module declarations from 'sage' */
2248
2249
/* Module declarations from 'sage.structure.coerce_dict' */
2250
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = 0;
2251
static PyTypeObject *__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = 0;
2252
2253
/* Module declarations from 'sage.structure.parent' */
2254
static PyTypeObject *__pyx_ptype_4sage_9structure_6parent_Parent = 0;
2255
2256
/* Module declarations from 'sage.misc.inherit_comparison' */
2257
static PyTypeObject *__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = 0;
2258
2259
/* Module declarations from 'sage.structure.element' */
2260
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Element = 0;
2261
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = 0;
2262
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_ModuleElement = 0;
2263
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_RingElement = 0;
2264
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MonoidElement = 0;
2265
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = 0;
2266
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = 0;
2267
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeRingElement = 0;
2268
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_IntegralDomainElement = 0;
2269
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_DedekindDomainElement = 0;
2270
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = 0;
2271
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = 0;
2272
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_FieldElement = 0;
2273
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_AlgebraElement = 0;
2274
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = 0;
2275
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_InfinityElement = 0;
2276
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Vector = 0;
2277
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_Matrix = 0;
2278
static PyTypeObject *__pyx_ptype_4sage_9structure_7element_CoercionModel = 0;
2279
static struct __pyx_obj_4sage_9structure_7element_CoercionModel **__pyx_vp_4sage_9structure_7element_coercion_model = 0;
2280
#define __pyx_v_4sage_9structure_7element_coercion_model (*__pyx_vp_4sage_9structure_7element_coercion_model)
2281
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *, int __pyx_skip_dispatch); /*proto*/
2282
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *, PyObject *); /*proto*/
2283
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int); /*proto*/
2284
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
2285
2286
/* Module declarations from 'sage.categories.map' */
2287
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Map = 0;
2288
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_Section = 0;
2289
static PyTypeObject *__pyx_ptype_4sage_10categories_3map_FormalCompositeMap = 0;
2290
2291
/* Module declarations from 'sage.categories.morphism' */
2292
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_Morphism = 0;
2293
static PyTypeObject *__pyx_ptype_4sage_10categories_8morphism_SetMorphism = 0;
2294
2295
/* Module declarations from 'sage.rings.integer' */
2296
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_Integer = 0;
2297
static PyTypeObject *__pyx_ptype_4sage_5rings_7integer_int_to_Z = 0;
2298
2299
/* Module declarations from 'code.alex.psage.psage.ellcurve.galrep.wrapper' */
2300
static PyTypeObject *__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep = 0;
2301
static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = 0;
2302
static PyObject *__Pyx_CFunc_object____object____object____int___to_py(PyObject *(*)(PyObject *, PyObject *, int)); /*proto*/
2303
#define __Pyx_MODULE_NAME "code.alex.psage.psage.ellcurve.galrep.wrapper"
2304
int __pyx_module_is_main_code__alex__psage__psage__ellcurve__galrep__wrapper = 0;
2305
2306
/* Implementation of 'code.alex.psage.psage.ellcurve.galrep.wrapper' */
2307
static PyObject *__pyx_builtin_IOError;
2308
static PyObject *__pyx_builtin_ValueError;
2309
static PyObject *__pyx_builtin_range;
2310
static PyObject *__pyx_builtin_AttributeError;
2311
static PyObject *__pyx_builtin_MemoryError;
2312
static const char __pyx_k_A[] = "A";
2313
static const char __pyx_k_B[] = "B";
2314
static const char __pyx_k_c[] = "c";
2315
static const char __pyx_k_x[] = "x";
2316
static const char __pyx_k_y[] = "y";
2317
static const char __pyx_k_op[] = "op";
2318
static const char __pyx_k_os[] = "os";
2319
static const char __pyx_k_ell[] = "ell";
2320
static const char __pyx_k_max[] = "max";
2321
static const char __pyx_k_min[] = "min";
2322
static const char __pyx_k_arg0[] = "arg0";
2323
static const char __pyx_k_arg1[] = "arg1";
2324
static const char __pyx_k_arg2[] = "arg2";
2325
static const char __pyx_k_file[] = "__file__";
2326
static const char __pyx_k_join[] = "join";
2327
static const char __pyx_k_left[] = "left";
2328
static const char __pyx_k_main[] = "__main__";
2329
static const char __pyx_k_path[] = "path";
2330
static const char __pyx_k_test[] = "__test__";
2331
static const char __pyx_k_wrap[] = "wrap";
2332
static const char __pyx_k_range[] = "range";
2333
static const char __pyx_k_right[] = "right";
2334
static const char __pyx_k_exists[] = "exists";
2335
static const char __pyx_k_import[] = "__import__";
2336
static const char __pyx_k_parent[] = "parent";
2337
static const char __pyx_k_IOError[] = "IOError";
2338
static const char __pyx_k_abspath[] = "abspath";
2339
static const char __pyx_k_dirname[] = "dirname";
2340
static const char __pyx_k_no_file_s[] = "no file '%s'";
2341
static const char __pyx_k_ValueError[] = "ValueError";
2342
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2343
static const char __pyx_k_MemoryError[] = "MemoryError";
2344
static const char __pyx_k_cfunc_to_py[] = "cfunc.to_py";
2345
static const char __pyx_k_stringsource[] = "stringsource";
2346
static const char __pyx_k_galrep_ecdata[] = "galrep_ecdata";
2347
static const char __pyx_k_max_must_be_s[] = "max must be <= %s";
2348
static const char __pyx_k_AttributeError[] = "AttributeError";
2349
static const char __pyx_k_galrep_gl2data[] = "galrep_gl2data";
2350
static const char __pyx_k_sage_ext_memory[] = "sage.ext.memory";
2351
static const char __pyx_k_galrep_ecdata_dat[] = "galrep_ecdata.dat";
2352
static const char __pyx_k_galrep_gl2data_dat[] = "galrep_gl2data.dat";
2353
static const char __pyx_k_init_memory_functions[] = "init_memory_functions";
2354
static const char __pyx_k_min_and_max_must_be_s[] = "min and max must be <= %s";
2355
static const char __pyx_k_ell_s_must_be_a_prime_s[] = "ell (=%s) must be a prime <= %s";
2356
static const char __pyx_k_Pyx_CFunc_object____object[] = "__Pyx_CFunc_object____object____object____int___to_py.<locals>.wrap";
2357
static const char __pyx_k_failed_to_allocate_s_bytes[] = "failed to allocate %s bytes";
2358
static const char __pyx_k_max_must_be_bigger_than_min[] = "max must be bigger than min";
2359
static const char __pyx_k_failed_to_allocate_s_s_bytes[] = "failed to allocate %s * %s bytes";
2360
static const char __pyx_k_Andrew_Sutherland_s_Probabilisti[] = "Andrew Sutherland's Probabilistic Image of Galois Algorithm";
2361
static const char __pyx_k_File_wrapper_pyx_starting_at_lin[] = "File: wrapper.pyx (starting at line 1)\n\nAndrew Sutherland's Probabilistic Image of Galois Algorithm\n\nAUTHOR:\n\n - William Stein, 2010-03 -- wrote the Cython wrapper\n - Sutherland -- wrote the C code and designed the algorithm\n";
2362
static PyObject *__pyx_n_s_A;
2363
static PyObject *__pyx_kp_s_Andrew_Sutherland_s_Probabilisti;
2364
static PyObject *__pyx_n_s_AttributeError;
2365
static PyObject *__pyx_n_s_B;
2366
static PyObject *__pyx_n_s_IOError;
2367
static PyObject *__pyx_n_s_MemoryError;
2368
static PyObject *__pyx_n_s_Pyx_CFunc_object____object;
2369
static PyObject *__pyx_n_s_ValueError;
2370
static PyObject *__pyx_n_s_abspath;
2371
static PyObject *__pyx_n_s_arg0;
2372
static PyObject *__pyx_n_s_arg1;
2373
static PyObject *__pyx_n_s_arg2;
2374
static PyObject *__pyx_n_s_c;
2375
static PyObject *__pyx_n_s_cfunc_to_py;
2376
static PyObject *__pyx_n_s_dirname;
2377
static PyObject *__pyx_n_s_ell;
2378
static PyObject *__pyx_kp_s_ell_s_must_be_a_prime_s;
2379
static PyObject *__pyx_n_s_exists;
2380
static PyObject *__pyx_kp_s_failed_to_allocate_s_bytes;
2381
static PyObject *__pyx_kp_s_failed_to_allocate_s_s_bytes;
2382
static PyObject *__pyx_n_s_file;
2383
static PyObject *__pyx_n_s_galrep_ecdata;
2384
static PyObject *__pyx_kp_s_galrep_ecdata_dat;
2385
static PyObject *__pyx_n_s_galrep_gl2data;
2386
static PyObject *__pyx_kp_s_galrep_gl2data_dat;
2387
static PyObject *__pyx_n_s_import;
2388
static PyObject *__pyx_n_s_init_memory_functions;
2389
static PyObject *__pyx_n_s_join;
2390
static PyObject *__pyx_n_s_left;
2391
static PyObject *__pyx_n_s_main;
2392
static PyObject *__pyx_n_s_max;
2393
static PyObject *__pyx_kp_s_max_must_be_bigger_than_min;
2394
static PyObject *__pyx_kp_s_max_must_be_s;
2395
static PyObject *__pyx_n_s_min;
2396
static PyObject *__pyx_kp_s_min_and_max_must_be_s;
2397
static PyObject *__pyx_kp_s_no_file_s;
2398
static PyObject *__pyx_n_s_op;
2399
static PyObject *__pyx_n_s_os;
2400
static PyObject *__pyx_n_s_parent;
2401
static PyObject *__pyx_n_s_path;
2402
static PyObject *__pyx_n_s_pyx_vtable;
2403
static PyObject *__pyx_n_s_range;
2404
static PyObject *__pyx_n_s_right;
2405
static PyObject *__pyx_n_s_sage_ext_memory;
2406
static PyObject *__pyx_kp_s_stringsource;
2407
static PyObject *__pyx_n_s_test;
2408
static PyObject *__pyx_n_s_wrap;
2409
static PyObject *__pyx_n_s_x;
2410
static PyObject *__pyx_n_s_y;
2411
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, PyObject *__pyx_v_galrep_ecdata, PyObject *__pyx_v_galrep_gl2data); /* proto */
2412
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_2mod_ell_image(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B, int __pyx_v_ell); /* proto */
2413
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_4mod_ell_images(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B, int __pyx_v_min, int __pyx_v_max); /* proto */
2414
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_6non_surjective_primes(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B, int __pyx_v_min, int __pyx_v_max); /* proto */
2415
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self); /* proto */
2416
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
2417
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
2418
static PyObject *__pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /* proto */
2419
static PyObject *__pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c); /* proto */
2420
static PyObject *__pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c); /* proto */
2421
static PyObject *__pyx_pf_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_arg0, PyObject *__pyx_v_arg1, int __pyx_v_arg2); /* proto */
2422
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2423
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2424
static PyObject *__pyx_int_2;
2425
static PyObject *__pyx_int_3;
2426
static PyObject *__pyx_int_5;
2427
static PyObject *__pyx_int_7;
2428
static PyObject *__pyx_int_11;
2429
static PyObject *__pyx_int_13;
2430
static PyObject *__pyx_int_17;
2431
static PyObject *__pyx_int_19;
2432
static PyObject *__pyx_int_23;
2433
static PyObject *__pyx_int_29;
2434
static PyObject *__pyx_int_31;
2435
static PyObject *__pyx_int_37;
2436
static PyObject *__pyx_int_41;
2437
static PyObject *__pyx_int_43;
2438
static PyObject *__pyx_int_47;
2439
static PyObject *__pyx_int_53;
2440
static PyObject *__pyx_int_59;
2441
static PyObject *__pyx_tuple_;
2442
static PyObject *__pyx_codeobj__2;
2443
2444
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":55
2445
* cdef object primes
2446
*
2447
* def __init__(self, galrep_ecdata=None, galrep_gl2data=None): # <<<<<<<<<<<<<<
2448
* """
2449
* INPUT:
2450
*/
2451
2452
/* Python wrapper */
2453
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2454
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__[] = "File: wrapper.pyx (starting at line 55)\n\n INPUT:\n\n - galrep_ecdata -- (default: None); if given, specifies galrep_ecdata.dat filename\n\n - galrep_gl2data -- (default: None); if given, specifies galrep_gl2data.dat filename\n \n EXAMPLES::\n\n sage: from psage.ellcurve.galrep import GalRep\n sage: GalRep()\n Andrew Sutherland's Probabilistic Image of Galois Algorithm\n ";
2455
#if CYTHON_COMPILING_IN_CPYTHON
2456
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__;
2457
#endif
2458
static int __pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2459
PyObject *__pyx_v_galrep_ecdata = 0;
2460
PyObject *__pyx_v_galrep_gl2data = 0;
2461
int __pyx_r;
2462
__Pyx_RefNannyDeclarations
2463
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2464
{
2465
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_galrep_ecdata,&__pyx_n_s_galrep_gl2data,0};
2466
PyObject* values[2] = {0,0};
2467
values[0] = ((PyObject *)Py_None);
2468
values[1] = ((PyObject *)Py_None);
2469
if (unlikely(__pyx_kwds)) {
2470
Py_ssize_t kw_args;
2471
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2472
switch (pos_args) {
2473
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2474
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2475
case 0: break;
2476
default: goto __pyx_L5_argtuple_error;
2477
}
2478
kw_args = PyDict_Size(__pyx_kwds);
2479
switch (pos_args) {
2480
case 0:
2481
if (kw_args > 0) {
2482
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_galrep_ecdata);
2483
if (value) { values[0] = value; kw_args--; }
2484
}
2485
case 1:
2486
if (kw_args > 0) {
2487
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_galrep_gl2data);
2488
if (value) { values[1] = value; kw_args--; }
2489
}
2490
}
2491
if (unlikely(kw_args > 0)) {
2492
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 55, __pyx_L3_error)
2493
}
2494
} else {
2495
switch (PyTuple_GET_SIZE(__pyx_args)) {
2496
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2497
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2498
case 0: break;
2499
default: goto __pyx_L5_argtuple_error;
2500
}
2501
}
2502
__pyx_v_galrep_ecdata = values[0];
2503
__pyx_v_galrep_gl2data = values[1];
2504
}
2505
goto __pyx_L4_argument_unpacking_done;
2506
__pyx_L5_argtuple_error:;
2507
__Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 55, __pyx_L3_error)
2508
__pyx_L3_error:;
2509
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2510
__Pyx_RefNannyFinishContext();
2511
return -1;
2512
__pyx_L4_argument_unpacking_done:;
2513
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)__pyx_v_self), __pyx_v_galrep_ecdata, __pyx_v_galrep_gl2data);
2514
2515
/* function exit code */
2516
__Pyx_RefNannyFinishContext();
2517
return __pyx_r;
2518
}
2519
2520
static int __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, PyObject *__pyx_v_galrep_ecdata, PyObject *__pyx_v_galrep_gl2data) {
2521
PyObject *__pyx_v_os = NULL;
2522
PyObject *__pyx_v_base = NULL;
2523
PyObject *__pyx_v_f = NULL;
2524
int __pyx_r;
2525
__Pyx_RefNannyDeclarations
2526
PyObject *__pyx_t_1 = NULL;
2527
PyObject *__pyx_t_2 = NULL;
2528
PyObject *__pyx_t_3 = NULL;
2529
PyObject *__pyx_t_4 = NULL;
2530
PyObject *__pyx_t_5 = NULL;
2531
PyObject *__pyx_t_6 = NULL;
2532
PyObject *__pyx_t_7 = NULL;
2533
int __pyx_t_8;
2534
int __pyx_t_9;
2535
int __pyx_t_10;
2536
Py_ssize_t __pyx_t_11;
2537
char *__pyx_t_12;
2538
__Pyx_RefNannySetupContext("__init__", 0);
2539
__Pyx_INCREF(__pyx_v_galrep_ecdata);
2540
__Pyx_INCREF(__pyx_v_galrep_gl2data);
2541
2542
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":69
2543
* Andrew Sutherland's Probabilistic Image of Galois Algorithm
2544
* """
2545
* import os # <<<<<<<<<<<<<<
2546
* base = os.path.abspath(os.path.dirname(__file__))
2547
* if galrep_ecdata is None:
2548
*/
2549
__pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2550
__Pyx_GOTREF(__pyx_t_1);
2551
__pyx_v_os = __pyx_t_1;
2552
__pyx_t_1 = 0;
2553
2554
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":70
2555
* """
2556
* import os
2557
* base = os.path.abspath(os.path.dirname(__file__)) # <<<<<<<<<<<<<<
2558
* if galrep_ecdata is None:
2559
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat')
2560
*/
2561
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
2562
__Pyx_GOTREF(__pyx_t_2);
2563
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_abspath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
2564
__Pyx_GOTREF(__pyx_t_3);
2565
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2566
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
2567
__Pyx_GOTREF(__pyx_t_4);
2568
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dirname); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error)
2569
__Pyx_GOTREF(__pyx_t_5);
2570
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2571
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_file); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error)
2572
__Pyx_GOTREF(__pyx_t_4);
2573
__pyx_t_6 = NULL;
2574
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2575
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
2576
if (likely(__pyx_t_6)) {
2577
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2578
__Pyx_INCREF(__pyx_t_6);
2579
__Pyx_INCREF(function);
2580
__Pyx_DECREF_SET(__pyx_t_5, function);
2581
}
2582
}
2583
if (!__pyx_t_6) {
2584
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
2585
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2586
__Pyx_GOTREF(__pyx_t_2);
2587
} else {
2588
#if CYTHON_FAST_PYCALL
2589
if (PyFunction_Check(__pyx_t_5)) {
2590
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
2591
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
2592
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2593
__Pyx_GOTREF(__pyx_t_2);
2594
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2595
} else
2596
#endif
2597
#if CYTHON_FAST_PYCCALL
2598
if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
2599
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
2600
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
2601
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2602
__Pyx_GOTREF(__pyx_t_2);
2603
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2604
} else
2605
#endif
2606
{
2607
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
2608
__Pyx_GOTREF(__pyx_t_7);
2609
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
2610
__Pyx_GIVEREF(__pyx_t_4);
2611
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
2612
__pyx_t_4 = 0;
2613
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
2614
__Pyx_GOTREF(__pyx_t_2);
2615
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2616
}
2617
}
2618
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2619
__pyx_t_5 = NULL;
2620
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2621
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
2622
if (likely(__pyx_t_5)) {
2623
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2624
__Pyx_INCREF(__pyx_t_5);
2625
__Pyx_INCREF(function);
2626
__Pyx_DECREF_SET(__pyx_t_3, function);
2627
}
2628
}
2629
if (!__pyx_t_5) {
2630
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2631
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2632
__Pyx_GOTREF(__pyx_t_1);
2633
} else {
2634
#if CYTHON_FAST_PYCALL
2635
if (PyFunction_Check(__pyx_t_3)) {
2636
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_2};
2637
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2638
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2639
__Pyx_GOTREF(__pyx_t_1);
2640
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2641
} else
2642
#endif
2643
#if CYTHON_FAST_PYCCALL
2644
if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2645
PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_2};
2646
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2647
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2648
__Pyx_GOTREF(__pyx_t_1);
2649
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2650
} else
2651
#endif
2652
{
2653
__pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error)
2654
__Pyx_GOTREF(__pyx_t_7);
2655
__Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
2656
__Pyx_GIVEREF(__pyx_t_2);
2657
PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_2);
2658
__pyx_t_2 = 0;
2659
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2660
__Pyx_GOTREF(__pyx_t_1);
2661
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2662
}
2663
}
2664
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2665
__pyx_v_base = __pyx_t_1;
2666
__pyx_t_1 = 0;
2667
2668
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":71
2669
* import os
2670
* base = os.path.abspath(os.path.dirname(__file__))
2671
* if galrep_ecdata is None: # <<<<<<<<<<<<<<
2672
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat')
2673
* if galrep_gl2data is None:
2674
*/
2675
__pyx_t_8 = (__pyx_v_galrep_ecdata == Py_None);
2676
__pyx_t_9 = (__pyx_t_8 != 0);
2677
if (__pyx_t_9) {
2678
2679
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":72
2680
* base = os.path.abspath(os.path.dirname(__file__))
2681
* if galrep_ecdata is None:
2682
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat') # <<<<<<<<<<<<<<
2683
* if galrep_gl2data is None:
2684
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2685
*/
2686
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
2687
__Pyx_GOTREF(__pyx_t_3);
2688
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L1_error)
2689
__Pyx_GOTREF(__pyx_t_7);
2690
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2691
__pyx_t_3 = NULL;
2692
__pyx_t_10 = 0;
2693
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
2694
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
2695
if (likely(__pyx_t_3)) {
2696
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2697
__Pyx_INCREF(__pyx_t_3);
2698
__Pyx_INCREF(function);
2699
__Pyx_DECREF_SET(__pyx_t_7, function);
2700
__pyx_t_10 = 1;
2701
}
2702
}
2703
#if CYTHON_FAST_PYCALL
2704
if (PyFunction_Check(__pyx_t_7)) {
2705
PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_base, __pyx_kp_s_galrep_ecdata_dat};
2706
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
2707
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2708
__Pyx_GOTREF(__pyx_t_1);
2709
} else
2710
#endif
2711
#if CYTHON_FAST_PYCCALL
2712
if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
2713
PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_base, __pyx_kp_s_galrep_ecdata_dat};
2714
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
2715
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2716
__Pyx_GOTREF(__pyx_t_1);
2717
} else
2718
#endif
2719
{
2720
__pyx_t_2 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
2721
__Pyx_GOTREF(__pyx_t_2);
2722
if (__pyx_t_3) {
2723
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
2724
}
2725
__Pyx_INCREF(__pyx_v_base);
2726
__Pyx_GIVEREF(__pyx_v_base);
2727
PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_v_base);
2728
__Pyx_INCREF(__pyx_kp_s_galrep_ecdata_dat);
2729
__Pyx_GIVEREF(__pyx_kp_s_galrep_ecdata_dat);
2730
PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_kp_s_galrep_ecdata_dat);
2731
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
2732
__Pyx_GOTREF(__pyx_t_1);
2733
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2734
}
2735
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2736
__Pyx_DECREF_SET(__pyx_v_galrep_ecdata, __pyx_t_1);
2737
__pyx_t_1 = 0;
2738
2739
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":71
2740
* import os
2741
* base = os.path.abspath(os.path.dirname(__file__))
2742
* if galrep_ecdata is None: # <<<<<<<<<<<<<<
2743
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat')
2744
* if galrep_gl2data is None:
2745
*/
2746
}
2747
2748
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":73
2749
* if galrep_ecdata is None:
2750
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat')
2751
* if galrep_gl2data is None: # <<<<<<<<<<<<<<
2752
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2753
* for f in [galrep_ecdata, galrep_gl2data]:
2754
*/
2755
__pyx_t_9 = (__pyx_v_galrep_gl2data == Py_None);
2756
__pyx_t_8 = (__pyx_t_9 != 0);
2757
if (__pyx_t_8) {
2758
2759
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":74
2760
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat')
2761
* if galrep_gl2data is None:
2762
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat') # <<<<<<<<<<<<<<
2763
* for f in [galrep_ecdata, galrep_gl2data]:
2764
* if not os.path.exists(f):
2765
*/
2766
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error)
2767
__Pyx_GOTREF(__pyx_t_7);
2768
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
2769
__Pyx_GOTREF(__pyx_t_2);
2770
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2771
__pyx_t_7 = NULL;
2772
__pyx_t_10 = 0;
2773
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2774
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
2775
if (likely(__pyx_t_7)) {
2776
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2777
__Pyx_INCREF(__pyx_t_7);
2778
__Pyx_INCREF(function);
2779
__Pyx_DECREF_SET(__pyx_t_2, function);
2780
__pyx_t_10 = 1;
2781
}
2782
}
2783
#if CYTHON_FAST_PYCALL
2784
if (PyFunction_Check(__pyx_t_2)) {
2785
PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_base, __pyx_kp_s_galrep_gl2data_dat};
2786
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
2787
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2788
__Pyx_GOTREF(__pyx_t_1);
2789
} else
2790
#endif
2791
#if CYTHON_FAST_PYCCALL
2792
if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
2793
PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_base, __pyx_kp_s_galrep_gl2data_dat};
2794
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
2795
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2796
__Pyx_GOTREF(__pyx_t_1);
2797
} else
2798
#endif
2799
{
2800
__pyx_t_3 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
2801
__Pyx_GOTREF(__pyx_t_3);
2802
if (__pyx_t_7) {
2803
__Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
2804
}
2805
__Pyx_INCREF(__pyx_v_base);
2806
__Pyx_GIVEREF(__pyx_v_base);
2807
PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_10, __pyx_v_base);
2808
__Pyx_INCREF(__pyx_kp_s_galrep_gl2data_dat);
2809
__Pyx_GIVEREF(__pyx_kp_s_galrep_gl2data_dat);
2810
PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_10, __pyx_kp_s_galrep_gl2data_dat);
2811
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
2812
__Pyx_GOTREF(__pyx_t_1);
2813
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2814
}
2815
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2816
__Pyx_DECREF_SET(__pyx_v_galrep_gl2data, __pyx_t_1);
2817
__pyx_t_1 = 0;
2818
2819
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":73
2820
* if galrep_ecdata is None:
2821
* galrep_ecdata = os.path.join(base, 'galrep_ecdata.dat')
2822
* if galrep_gl2data is None: # <<<<<<<<<<<<<<
2823
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2824
* for f in [galrep_ecdata, galrep_gl2data]:
2825
*/
2826
}
2827
2828
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":75
2829
* if galrep_gl2data is None:
2830
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2831
* for f in [galrep_ecdata, galrep_gl2data]: # <<<<<<<<<<<<<<
2832
* if not os.path.exists(f):
2833
* raise IOError, "no file '%s'"%f
2834
*/
2835
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
2836
__Pyx_GOTREF(__pyx_t_1);
2837
__Pyx_INCREF(__pyx_v_galrep_ecdata);
2838
__Pyx_GIVEREF(__pyx_v_galrep_ecdata);
2839
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_galrep_ecdata);
2840
__Pyx_INCREF(__pyx_v_galrep_gl2data);
2841
__Pyx_GIVEREF(__pyx_v_galrep_gl2data);
2842
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_galrep_gl2data);
2843
__pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0;
2844
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2845
for (;;) {
2846
if (__pyx_t_11 >= 2) break;
2847
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2848
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 75, __pyx_L1_error)
2849
#else
2850
__pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
2851
__Pyx_GOTREF(__pyx_t_1);
2852
#endif
2853
__Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_1);
2854
__pyx_t_1 = 0;
2855
2856
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":76
2857
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2858
* for f in [galrep_ecdata, galrep_gl2data]:
2859
* if not os.path.exists(f): # <<<<<<<<<<<<<<
2860
* raise IOError, "no file '%s'"%f
2861
* galrep_ecdata_load(galrep_ecdata)
2862
*/
2863
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
2864
__Pyx_GOTREF(__pyx_t_3);
2865
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exists); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 76, __pyx_L1_error)
2866
__Pyx_GOTREF(__pyx_t_7);
2867
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2868
__pyx_t_3 = NULL;
2869
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
2870
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
2871
if (likely(__pyx_t_3)) {
2872
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
2873
__Pyx_INCREF(__pyx_t_3);
2874
__Pyx_INCREF(function);
2875
__Pyx_DECREF_SET(__pyx_t_7, function);
2876
}
2877
}
2878
if (!__pyx_t_3) {
2879
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
2880
__Pyx_GOTREF(__pyx_t_1);
2881
} else {
2882
#if CYTHON_FAST_PYCALL
2883
if (PyFunction_Check(__pyx_t_7)) {
2884
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_f};
2885
__pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
2886
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2887
__Pyx_GOTREF(__pyx_t_1);
2888
} else
2889
#endif
2890
#if CYTHON_FAST_PYCCALL
2891
if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
2892
PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_f};
2893
__pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
2894
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2895
__Pyx_GOTREF(__pyx_t_1);
2896
} else
2897
#endif
2898
{
2899
__pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error)
2900
__Pyx_GOTREF(__pyx_t_5);
2901
__Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
2902
__Pyx_INCREF(__pyx_v_f);
2903
__Pyx_GIVEREF(__pyx_v_f);
2904
PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_f);
2905
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
2906
__Pyx_GOTREF(__pyx_t_1);
2907
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2908
}
2909
}
2910
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2911
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 76, __pyx_L1_error)
2912
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2913
__pyx_t_9 = ((!__pyx_t_8) != 0);
2914
if (__pyx_t_9) {
2915
2916
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":77
2917
* for f in [galrep_ecdata, galrep_gl2data]:
2918
* if not os.path.exists(f):
2919
* raise IOError, "no file '%s'"%f # <<<<<<<<<<<<<<
2920
* galrep_ecdata_load(galrep_ecdata)
2921
* galrep_gl2data_load(galrep_gl2data)
2922
*/
2923
__pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_no_file_s, __pyx_v_f); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
2924
__Pyx_GOTREF(__pyx_t_1);
2925
__Pyx_Raise(__pyx_builtin_IOError, __pyx_t_1, 0, 0);
2926
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2927
__PYX_ERR(0, 77, __pyx_L1_error)
2928
2929
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":76
2930
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2931
* for f in [galrep_ecdata, galrep_gl2data]:
2932
* if not os.path.exists(f): # <<<<<<<<<<<<<<
2933
* raise IOError, "no file '%s'"%f
2934
* galrep_ecdata_load(galrep_ecdata)
2935
*/
2936
}
2937
2938
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":75
2939
* if galrep_gl2data is None:
2940
* galrep_gl2data = os.path.join(base, 'galrep_gl2data.dat')
2941
* for f in [galrep_ecdata, galrep_gl2data]: # <<<<<<<<<<<<<<
2942
* if not os.path.exists(f):
2943
* raise IOError, "no file '%s'"%f
2944
*/
2945
}
2946
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2947
2948
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":78
2949
* if not os.path.exists(f):
2950
* raise IOError, "no file '%s'"%f
2951
* galrep_ecdata_load(galrep_ecdata) # <<<<<<<<<<<<<<
2952
* galrep_gl2data_load(galrep_gl2data)
2953
* self.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]
2954
*/
2955
__pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_galrep_ecdata); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
2956
galrep_ecdata_load(__pyx_t_12);
2957
2958
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":79
2959
* raise IOError, "no file '%s'"%f
2960
* galrep_ecdata_load(galrep_ecdata)
2961
* galrep_gl2data_load(galrep_gl2data) # <<<<<<<<<<<<<<
2962
* self.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]
2963
*
2964
*/
2965
__pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_galrep_gl2data); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
2966
galrep_gl2data_load(__pyx_t_12);
2967
2968
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":80
2969
* galrep_ecdata_load(galrep_ecdata)
2970
* galrep_gl2data_load(galrep_gl2data)
2971
* self.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59] # <<<<<<<<<<<<<<
2972
*
2973
* def mod_ell_image(self, Integer A, Integer B, int ell):
2974
*/
2975
__pyx_t_2 = PyList_New(17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
2976
__Pyx_GOTREF(__pyx_t_2);
2977
__Pyx_INCREF(__pyx_int_2);
2978
__Pyx_GIVEREF(__pyx_int_2);
2979
PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
2980
__Pyx_INCREF(__pyx_int_3);
2981
__Pyx_GIVEREF(__pyx_int_3);
2982
PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_3);
2983
__Pyx_INCREF(__pyx_int_5);
2984
__Pyx_GIVEREF(__pyx_int_5);
2985
PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_5);
2986
__Pyx_INCREF(__pyx_int_7);
2987
__Pyx_GIVEREF(__pyx_int_7);
2988
PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_7);
2989
__Pyx_INCREF(__pyx_int_11);
2990
__Pyx_GIVEREF(__pyx_int_11);
2991
PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_11);
2992
__Pyx_INCREF(__pyx_int_13);
2993
__Pyx_GIVEREF(__pyx_int_13);
2994
PyList_SET_ITEM(__pyx_t_2, 5, __pyx_int_13);
2995
__Pyx_INCREF(__pyx_int_17);
2996
__Pyx_GIVEREF(__pyx_int_17);
2997
PyList_SET_ITEM(__pyx_t_2, 6, __pyx_int_17);
2998
__Pyx_INCREF(__pyx_int_19);
2999
__Pyx_GIVEREF(__pyx_int_19);
3000
PyList_SET_ITEM(__pyx_t_2, 7, __pyx_int_19);
3001
__Pyx_INCREF(__pyx_int_23);
3002
__Pyx_GIVEREF(__pyx_int_23);
3003
PyList_SET_ITEM(__pyx_t_2, 8, __pyx_int_23);
3004
__Pyx_INCREF(__pyx_int_29);
3005
__Pyx_GIVEREF(__pyx_int_29);
3006
PyList_SET_ITEM(__pyx_t_2, 9, __pyx_int_29);
3007
__Pyx_INCREF(__pyx_int_31);
3008
__Pyx_GIVEREF(__pyx_int_31);
3009
PyList_SET_ITEM(__pyx_t_2, 10, __pyx_int_31);
3010
__Pyx_INCREF(__pyx_int_37);
3011
__Pyx_GIVEREF(__pyx_int_37);
3012
PyList_SET_ITEM(__pyx_t_2, 11, __pyx_int_37);
3013
__Pyx_INCREF(__pyx_int_41);
3014
__Pyx_GIVEREF(__pyx_int_41);
3015
PyList_SET_ITEM(__pyx_t_2, 12, __pyx_int_41);
3016
__Pyx_INCREF(__pyx_int_43);
3017
__Pyx_GIVEREF(__pyx_int_43);
3018
PyList_SET_ITEM(__pyx_t_2, 13, __pyx_int_43);
3019
__Pyx_INCREF(__pyx_int_47);
3020
__Pyx_GIVEREF(__pyx_int_47);
3021
PyList_SET_ITEM(__pyx_t_2, 14, __pyx_int_47);
3022
__Pyx_INCREF(__pyx_int_53);
3023
__Pyx_GIVEREF(__pyx_int_53);
3024
PyList_SET_ITEM(__pyx_t_2, 15, __pyx_int_53);
3025
__Pyx_INCREF(__pyx_int_59);
3026
__Pyx_GIVEREF(__pyx_int_59);
3027
PyList_SET_ITEM(__pyx_t_2, 16, __pyx_int_59);
3028
__Pyx_GIVEREF(__pyx_t_2);
3029
__Pyx_GOTREF(__pyx_v_self->primes);
3030
__Pyx_DECREF(__pyx_v_self->primes);
3031
__pyx_v_self->primes = __pyx_t_2;
3032
__pyx_t_2 = 0;
3033
3034
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":55
3035
* cdef object primes
3036
*
3037
* def __init__(self, galrep_ecdata=None, galrep_gl2data=None): # <<<<<<<<<<<<<<
3038
* """
3039
* INPUT:
3040
*/
3041
3042
/* function exit code */
3043
__pyx_r = 0;
3044
goto __pyx_L0;
3045
__pyx_L1_error:;
3046
__Pyx_XDECREF(__pyx_t_1);
3047
__Pyx_XDECREF(__pyx_t_2);
3048
__Pyx_XDECREF(__pyx_t_3);
3049
__Pyx_XDECREF(__pyx_t_4);
3050
__Pyx_XDECREF(__pyx_t_5);
3051
__Pyx_XDECREF(__pyx_t_6);
3052
__Pyx_XDECREF(__pyx_t_7);
3053
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3054
__pyx_r = -1;
3055
__pyx_L0:;
3056
__Pyx_XDECREF(__pyx_v_os);
3057
__Pyx_XDECREF(__pyx_v_base);
3058
__Pyx_XDECREF(__pyx_v_f);
3059
__Pyx_XDECREF(__pyx_v_galrep_ecdata);
3060
__Pyx_XDECREF(__pyx_v_galrep_gl2data);
3061
__Pyx_RefNannyFinishContext();
3062
return __pyx_r;
3063
}
3064
3065
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":82
3066
* self.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]
3067
*
3068
* def mod_ell_image(self, Integer A, Integer B, int ell): # <<<<<<<<<<<<<<
3069
* """
3070
* Returns the conjugacy class id of the image of the mod-ell
3071
*/
3072
3073
/* Python wrapper */
3074
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_3mod_ell_image(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3075
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_2mod_ell_image[] = "File: wrapper.pyx (starting at line 82)\n\n Returns the conjugacy class id of the image of the mod-ell\n Galois representation attached to the elliptic curve\n y^2=x^3+A*x+B. The id code 0 signifies a surjective\n representation.\n\n INPUT:\n - A -- integer\n - B -- integer\n - ell -- prime integer (must be <= 59)\n\n OUTPUT:\n - integer\n\n EXAMPLES::\n\n sage: from psage.ellcurve.galrep import GalRep\n sage: GalRep().mod_ell_image(-432,8208,3)\n 0\n sage: GalRep().mod_ell_image(-432,8208,2)\n 0\n sage: GalRep().mod_ell_image(-432,8208,5)\n 9\n sage: GalRep().mod_ell_image(-432,8208,0)\n Traceback (most recent call last):\n ...\n ValueError: ell (=0) must be a prime <= 59\n sage: GalRep().mod_ell_image(-432,8208,67)\n Traceback (most recent call last):\n ...\n ValueError: ell (=67) must be a prime <= 59\n ";
3076
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_3mod_ell_image(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3077
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A = 0;
3078
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B = 0;
3079
int __pyx_v_ell;
3080
PyObject *__pyx_r = 0;
3081
__Pyx_RefNannyDeclarations
3082
__Pyx_RefNannySetupContext("mod_ell_image (wrapper)", 0);
3083
{
3084
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_ell,0};
3085
PyObject* values[3] = {0,0,0};
3086
if (unlikely(__pyx_kwds)) {
3087
Py_ssize_t kw_args;
3088
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3089
switch (pos_args) {
3090
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3091
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3092
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3093
case 0: break;
3094
default: goto __pyx_L5_argtuple_error;
3095
}
3096
kw_args = PyDict_Size(__pyx_kwds);
3097
switch (pos_args) {
3098
case 0:
3099
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
3100
else goto __pyx_L5_argtuple_error;
3101
case 1:
3102
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
3103
else {
3104
__Pyx_RaiseArgtupleInvalid("mod_ell_image", 1, 3, 3, 1); __PYX_ERR(0, 82, __pyx_L3_error)
3105
}
3106
case 2:
3107
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ell)) != 0)) kw_args--;
3108
else {
3109
__Pyx_RaiseArgtupleInvalid("mod_ell_image", 1, 3, 3, 2); __PYX_ERR(0, 82, __pyx_L3_error)
3110
}
3111
}
3112
if (unlikely(kw_args > 0)) {
3113
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mod_ell_image") < 0)) __PYX_ERR(0, 82, __pyx_L3_error)
3114
}
3115
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3116
goto __pyx_L5_argtuple_error;
3117
} else {
3118
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3119
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3120
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3121
}
3122
__pyx_v_A = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)values[0]);
3123
__pyx_v_B = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)values[1]);
3124
__pyx_v_ell = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_ell == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L3_error)
3125
}
3126
goto __pyx_L4_argument_unpacking_done;
3127
__pyx_L5_argtuple_error:;
3128
__Pyx_RaiseArgtupleInvalid("mod_ell_image", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 82, __pyx_L3_error)
3129
__pyx_L3_error:;
3130
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.mod_ell_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
3131
__Pyx_RefNannyFinishContext();
3132
return NULL;
3133
__pyx_L4_argument_unpacking_done:;
3134
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_4sage_5rings_7integer_Integer, 1, "A", 0))) __PYX_ERR(0, 82, __pyx_L1_error)
3135
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_4sage_5rings_7integer_Integer, 1, "B", 0))) __PYX_ERR(0, 82, __pyx_L1_error)
3136
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_2mod_ell_image(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_ell);
3137
3138
/* function exit code */
3139
goto __pyx_L0;
3140
__pyx_L1_error:;
3141
__pyx_r = NULL;
3142
__pyx_L0:;
3143
__Pyx_RefNannyFinishContext();
3144
return __pyx_r;
3145
}
3146
3147
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_2mod_ell_image(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B, int __pyx_v_ell) {
3148
int __pyx_v_a;
3149
PyObject *__pyx_r = NULL;
3150
__Pyx_RefNannyDeclarations
3151
int __pyx_t_1;
3152
PyObject *__pyx_t_2 = NULL;
3153
PyObject *__pyx_t_3 = NULL;
3154
PyObject *__pyx_t_4 = NULL;
3155
__Pyx_RefNannySetupContext("mod_ell_image", 0);
3156
3157
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":115
3158
* ValueError: ell (=67) must be a prime <= 59
3159
* """
3160
* cdef int a = galrep_ec_modl_image(ell, A.value, B.value, 0) # <<<<<<<<<<<<<<
3161
* if a == -1: raise ValueError, "ell (=%s) must be a prime <= %s"%(ell, GALREP_MAX_ELL)
3162
* return a
3163
*/
3164
__pyx_v_a = galrep_ec_modl_image(__pyx_v_ell, __pyx_v_A->value, __pyx_v_B->value, 0);
3165
3166
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":116
3167
* """
3168
* cdef int a = galrep_ec_modl_image(ell, A.value, B.value, 0)
3169
* if a == -1: raise ValueError, "ell (=%s) must be a prime <= %s"%(ell, GALREP_MAX_ELL) # <<<<<<<<<<<<<<
3170
* return a
3171
*
3172
*/
3173
__pyx_t_1 = ((__pyx_v_a == -1L) != 0);
3174
if (__pyx_t_1) {
3175
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
3176
__Pyx_GOTREF(__pyx_t_2);
3177
__pyx_t_3 = __Pyx_PyInt_From_int(GALREP_MAX_ELL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
3178
__Pyx_GOTREF(__pyx_t_3);
3179
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
3180
__Pyx_GOTREF(__pyx_t_4);
3181
__Pyx_GIVEREF(__pyx_t_2);
3182
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3183
__Pyx_GIVEREF(__pyx_t_3);
3184
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
3185
__pyx_t_2 = 0;
3186
__pyx_t_3 = 0;
3187
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_ell_s_must_be_a_prime_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
3188
__Pyx_GOTREF(__pyx_t_3);
3189
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3190
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
3191
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3192
__PYX_ERR(0, 116, __pyx_L1_error)
3193
}
3194
3195
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":117
3196
* cdef int a = galrep_ec_modl_image(ell, A.value, B.value, 0)
3197
* if a == -1: raise ValueError, "ell (=%s) must be a prime <= %s"%(ell, GALREP_MAX_ELL)
3198
* return a # <<<<<<<<<<<<<<
3199
*
3200
* def mod_ell_images(self, Integer A, Integer B, int min=2, int max=59):
3201
*/
3202
__Pyx_XDECREF(__pyx_r);
3203
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
3204
__Pyx_GOTREF(__pyx_t_3);
3205
__pyx_r = __pyx_t_3;
3206
__pyx_t_3 = 0;
3207
goto __pyx_L0;
3208
3209
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":82
3210
* self.primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59]
3211
*
3212
* def mod_ell_image(self, Integer A, Integer B, int ell): # <<<<<<<<<<<<<<
3213
* """
3214
* Returns the conjugacy class id of the image of the mod-ell
3215
*/
3216
3217
/* function exit code */
3218
__pyx_L1_error:;
3219
__Pyx_XDECREF(__pyx_t_2);
3220
__Pyx_XDECREF(__pyx_t_3);
3221
__Pyx_XDECREF(__pyx_t_4);
3222
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.mod_ell_image", __pyx_clineno, __pyx_lineno, __pyx_filename);
3223
__pyx_r = NULL;
3224
__pyx_L0:;
3225
__Pyx_XGIVEREF(__pyx_r);
3226
__Pyx_RefNannyFinishContext();
3227
return __pyx_r;
3228
}
3229
3230
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":119
3231
* return a
3232
*
3233
* def mod_ell_images(self, Integer A, Integer B, int min=2, int max=59): # <<<<<<<<<<<<<<
3234
* """
3235
* Returns list of the conjugacy class id's of the images of the
3236
*/
3237
3238
/* Python wrapper */
3239
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_5mod_ell_images(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3240
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_4mod_ell_images[] = "File: wrapper.pyx (starting at line 119)\n\n Returns list of the conjugacy class id's of the images of the\n mod-ell Galois representation attached to the elliptic curve\n y^2=x^3+A*x+B for ell in the interval [min, max]. The id code\n 0 signifies a surjective representation.\n\n INPUT:\n - A -- integer\n - B -- integer\n - min -- integer (default: 2)\n - max -- integer (default: 59) (must be <= 59)\n\n OUTPUT:\n - list of primes\n\n EXAMPLES::\n\n sage: from psage.ellcurve.galrep import GalRep\n sage: GalRep().mod_ell_images(-432,8208)\n [0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n sage: GalRep().mod_ell_images(-432,8208,2,10)\n [0, 0, 9, 0]\n ";
3241
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_5mod_ell_images(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3242
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A = 0;
3243
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B = 0;
3244
int __pyx_v_min;
3245
int __pyx_v_max;
3246
PyObject *__pyx_r = 0;
3247
__Pyx_RefNannyDeclarations
3248
__Pyx_RefNannySetupContext("mod_ell_images (wrapper)", 0);
3249
{
3250
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_min,&__pyx_n_s_max,0};
3251
PyObject* values[4] = {0,0,0,0};
3252
if (unlikely(__pyx_kwds)) {
3253
Py_ssize_t kw_args;
3254
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3255
switch (pos_args) {
3256
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3257
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3258
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3259
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3260
case 0: break;
3261
default: goto __pyx_L5_argtuple_error;
3262
}
3263
kw_args = PyDict_Size(__pyx_kwds);
3264
switch (pos_args) {
3265
case 0:
3266
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
3267
else goto __pyx_L5_argtuple_error;
3268
case 1:
3269
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
3270
else {
3271
__Pyx_RaiseArgtupleInvalid("mod_ell_images", 0, 2, 4, 1); __PYX_ERR(0, 119, __pyx_L3_error)
3272
}
3273
case 2:
3274
if (kw_args > 0) {
3275
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min);
3276
if (value) { values[2] = value; kw_args--; }
3277
}
3278
case 3:
3279
if (kw_args > 0) {
3280
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max);
3281
if (value) { values[3] = value; kw_args--; }
3282
}
3283
}
3284
if (unlikely(kw_args > 0)) {
3285
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mod_ell_images") < 0)) __PYX_ERR(0, 119, __pyx_L3_error)
3286
}
3287
} else {
3288
switch (PyTuple_GET_SIZE(__pyx_args)) {
3289
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3290
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3291
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3292
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3293
break;
3294
default: goto __pyx_L5_argtuple_error;
3295
}
3296
}
3297
__pyx_v_A = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)values[0]);
3298
__pyx_v_B = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)values[1]);
3299
if (values[2]) {
3300
__pyx_v_min = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_min == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
3301
} else {
3302
__pyx_v_min = ((int)2);
3303
}
3304
if (values[3]) {
3305
__pyx_v_max = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
3306
} else {
3307
__pyx_v_max = ((int)59);
3308
}
3309
}
3310
goto __pyx_L4_argument_unpacking_done;
3311
__pyx_L5_argtuple_error:;
3312
__Pyx_RaiseArgtupleInvalid("mod_ell_images", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 119, __pyx_L3_error)
3313
__pyx_L3_error:;
3314
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.mod_ell_images", __pyx_clineno, __pyx_lineno, __pyx_filename);
3315
__Pyx_RefNannyFinishContext();
3316
return NULL;
3317
__pyx_L4_argument_unpacking_done:;
3318
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_4sage_5rings_7integer_Integer, 1, "A", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
3319
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_4sage_5rings_7integer_Integer, 1, "B", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
3320
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_4mod_ell_images(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_min, __pyx_v_max);
3321
3322
/* function exit code */
3323
goto __pyx_L0;
3324
__pyx_L1_error:;
3325
__pyx_r = NULL;
3326
__pyx_L0:;
3327
__Pyx_RefNannyFinishContext();
3328
return __pyx_r;
3329
}
3330
3331
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_4mod_ell_images(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B, int __pyx_v_min, int __pyx_v_max) {
3332
int *__pyx_v_ccs;
3333
int __pyx_v_i;
3334
CYTHON_UNUSED int __pyx_v_a;
3335
PyObject *__pyx_v_v = 0;
3336
PyObject *__pyx_r = NULL;
3337
__Pyx_RefNannyDeclarations
3338
int __pyx_t_1;
3339
PyObject *__pyx_t_2 = NULL;
3340
PyObject *__pyx_t_3 = NULL;
3341
Py_ssize_t __pyx_t_4;
3342
int __pyx_t_5;
3343
PyObject *__pyx_t_6 = NULL;
3344
int __pyx_t_7;
3345
__Pyx_RefNannySetupContext("mod_ell_images", 0);
3346
3347
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":143
3348
* [0, 0, 9, 0]
3349
* """
3350
* if min >= max: # <<<<<<<<<<<<<<
3351
* raise ValueError, "max must be bigger than min"
3352
* if max > GALREP_MAX_ELL:
3353
*/
3354
__pyx_t_1 = ((__pyx_v_min >= __pyx_v_max) != 0);
3355
if (__pyx_t_1) {
3356
3357
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":144
3358
* """
3359
* if min >= max:
3360
* raise ValueError, "max must be bigger than min" # <<<<<<<<<<<<<<
3361
* if max > GALREP_MAX_ELL:
3362
* raise ValueError, "max must be <= %s"%GALREP_MAX_ELL
3363
*/
3364
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_max_must_be_bigger_than_min, 0, 0);
3365
__PYX_ERR(0, 144, __pyx_L1_error)
3366
3367
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":143
3368
* [0, 0, 9, 0]
3369
* """
3370
* if min >= max: # <<<<<<<<<<<<<<
3371
* raise ValueError, "max must be bigger than min"
3372
* if max > GALREP_MAX_ELL:
3373
*/
3374
}
3375
3376
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":145
3377
* if min >= max:
3378
* raise ValueError, "max must be bigger than min"
3379
* if max > GALREP_MAX_ELL: # <<<<<<<<<<<<<<
3380
* raise ValueError, "max must be <= %s"%GALREP_MAX_ELL
3381
* cdef int* ccs = <int*> sage_malloc(sizeof(int)*len(self.primes))
3382
*/
3383
__pyx_t_1 = ((__pyx_v_max > GALREP_MAX_ELL) != 0);
3384
if (__pyx_t_1) {
3385
3386
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":146
3387
* raise ValueError, "max must be bigger than min"
3388
* if max > GALREP_MAX_ELL:
3389
* raise ValueError, "max must be <= %s"%GALREP_MAX_ELL # <<<<<<<<<<<<<<
3390
* cdef int* ccs = <int*> sage_malloc(sizeof(int)*len(self.primes))
3391
* cdef int i, a = galrep_ec_modl_images (ccs, min, max, A.value, B.value, 0)
3392
*/
3393
__pyx_t_2 = __Pyx_PyInt_From_int(GALREP_MAX_ELL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
3394
__Pyx_GOTREF(__pyx_t_2);
3395
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_max_must_be_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error)
3396
__Pyx_GOTREF(__pyx_t_3);
3397
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3398
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
3399
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3400
__PYX_ERR(0, 146, __pyx_L1_error)
3401
3402
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":145
3403
* if min >= max:
3404
* raise ValueError, "max must be bigger than min"
3405
* if max > GALREP_MAX_ELL: # <<<<<<<<<<<<<<
3406
* raise ValueError, "max must be <= %s"%GALREP_MAX_ELL
3407
* cdef int* ccs = <int*> sage_malloc(sizeof(int)*len(self.primes))
3408
*/
3409
}
3410
3411
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":147
3412
* if max > GALREP_MAX_ELL:
3413
* raise ValueError, "max must be <= %s"%GALREP_MAX_ELL
3414
* cdef int* ccs = <int*> sage_malloc(sizeof(int)*len(self.primes)) # <<<<<<<<<<<<<<
3415
* cdef int i, a = galrep_ec_modl_images (ccs, min, max, A.value, B.value, 0)
3416
* cdef list v = []
3417
*/
3418
__pyx_t_3 = __pyx_v_self->primes;
3419
__Pyx_INCREF(__pyx_t_3);
3420
__pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 147, __pyx_L1_error)
3421
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3422
__pyx_v_ccs = ((int *)sig_malloc(((sizeof(int)) * __pyx_t_4)));
3423
3424
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":148
3425
* raise ValueError, "max must be <= %s"%GALREP_MAX_ELL
3426
* cdef int* ccs = <int*> sage_malloc(sizeof(int)*len(self.primes))
3427
* cdef int i, a = galrep_ec_modl_images (ccs, min, max, A.value, B.value, 0) # <<<<<<<<<<<<<<
3428
* cdef list v = []
3429
* for i in range(len(self.primes)):
3430
*/
3431
__pyx_v_a = galrep_ec_modl_images(__pyx_v_ccs, __pyx_v_min, __pyx_v_max, __pyx_v_A->value, __pyx_v_B->value, 0);
3432
3433
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":149
3434
* cdef int* ccs = <int*> sage_malloc(sizeof(int)*len(self.primes))
3435
* cdef int i, a = galrep_ec_modl_images (ccs, min, max, A.value, B.value, 0)
3436
* cdef list v = [] # <<<<<<<<<<<<<<
3437
* for i in range(len(self.primes)):
3438
* if self.primes[i] > max: break
3439
*/
3440
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
3441
__Pyx_GOTREF(__pyx_t_3);
3442
__pyx_v_v = ((PyObject*)__pyx_t_3);
3443
__pyx_t_3 = 0;
3444
3445
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":150
3446
* cdef int i, a = galrep_ec_modl_images (ccs, min, max, A.value, B.value, 0)
3447
* cdef list v = []
3448
* for i in range(len(self.primes)): # <<<<<<<<<<<<<<
3449
* if self.primes[i] > max: break
3450
* v.append(ccs[i])
3451
*/
3452
__pyx_t_3 = __pyx_v_self->primes;
3453
__Pyx_INCREF(__pyx_t_3);
3454
__pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 150, __pyx_L1_error)
3455
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3456
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
3457
__pyx_v_i = __pyx_t_5;
3458
3459
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":151
3460
* cdef list v = []
3461
* for i in range(len(self.primes)):
3462
* if self.primes[i] > max: break # <<<<<<<<<<<<<<
3463
* v.append(ccs[i])
3464
* sage_free(ccs)
3465
*/
3466
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->primes, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error)
3467
__Pyx_GOTREF(__pyx_t_3);
3468
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
3469
__Pyx_GOTREF(__pyx_t_2);
3470
__pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error)
3471
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3472
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3473
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 151, __pyx_L1_error)
3474
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3475
if (__pyx_t_1) {
3476
goto __pyx_L6_break;
3477
}
3478
3479
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":152
3480
* for i in range(len(self.primes)):
3481
* if self.primes[i] > max: break
3482
* v.append(ccs[i]) # <<<<<<<<<<<<<<
3483
* sage_free(ccs)
3484
* return v
3485
*/
3486
__pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_ccs[__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 152, __pyx_L1_error)
3487
__Pyx_GOTREF(__pyx_t_6);
3488
__pyx_t_7 = __Pyx_PyList_Append(__pyx_v_v, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 152, __pyx_L1_error)
3489
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3490
}
3491
__pyx_L6_break:;
3492
3493
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":153
3494
* if self.primes[i] > max: break
3495
* v.append(ccs[i])
3496
* sage_free(ccs) # <<<<<<<<<<<<<<
3497
* return v
3498
*
3499
*/
3500
sig_free(__pyx_v_ccs);
3501
3502
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":154
3503
* v.append(ccs[i])
3504
* sage_free(ccs)
3505
* return v # <<<<<<<<<<<<<<
3506
*
3507
* def non_surjective_primes(self, Integer A, Integer B, int min=2, int max=59):
3508
*/
3509
__Pyx_XDECREF(__pyx_r);
3510
__Pyx_INCREF(__pyx_v_v);
3511
__pyx_r = __pyx_v_v;
3512
goto __pyx_L0;
3513
3514
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":119
3515
* return a
3516
*
3517
* def mod_ell_images(self, Integer A, Integer B, int min=2, int max=59): # <<<<<<<<<<<<<<
3518
* """
3519
* Returns list of the conjugacy class id's of the images of the
3520
*/
3521
3522
/* function exit code */
3523
__pyx_L1_error:;
3524
__Pyx_XDECREF(__pyx_t_2);
3525
__Pyx_XDECREF(__pyx_t_3);
3526
__Pyx_XDECREF(__pyx_t_6);
3527
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.mod_ell_images", __pyx_clineno, __pyx_lineno, __pyx_filename);
3528
__pyx_r = NULL;
3529
__pyx_L0:;
3530
__Pyx_XDECREF(__pyx_v_v);
3531
__Pyx_XGIVEREF(__pyx_r);
3532
__Pyx_RefNannyFinishContext();
3533
return __pyx_r;
3534
}
3535
3536
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":156
3537
* return v
3538
*
3539
* def non_surjective_primes(self, Integer A, Integer B, int min=2, int max=59): # <<<<<<<<<<<<<<
3540
* """
3541
* Returns a list of the primes ell in the interval [min, max]
3542
*/
3543
3544
/* Python wrapper */
3545
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_7non_surjective_primes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3546
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_6non_surjective_primes[] = "File: wrapper.pyx (starting at line 156)\n\n Returns a list of the primes ell in the interval [min, max]\n (default=[2,59]) such that the mod-ell Galois representation\n attached to y^2=x^3+A*x+B is highly likely to be\n non-surjective.\n\n INPUT:\n - A -- integer\n - B -- integer\n - min -- integer (default: 2)\n - max -- integer (default: 59) (must be <= 59)\n\n OUTPUT:\n - list of primes\n\n EXAMPLES::\n\n sage: from psage.ellcurve.galrep import GalRep\n sage: GalRep().non_surjective_primes(-432,8208)\n [5]\n sage: GalRep().non_surjective_primes(-432,8208,7,59)\n []\n sage: GalRep().non_surjective_primes(-432,8208,1,10)\n [5]\n ";
3547
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_7non_surjective_primes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3548
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A = 0;
3549
struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B = 0;
3550
int __pyx_v_min;
3551
int __pyx_v_max;
3552
PyObject *__pyx_r = 0;
3553
__Pyx_RefNannyDeclarations
3554
__Pyx_RefNannySetupContext("non_surjective_primes (wrapper)", 0);
3555
{
3556
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_min,&__pyx_n_s_max,0};
3557
PyObject* values[4] = {0,0,0,0};
3558
if (unlikely(__pyx_kwds)) {
3559
Py_ssize_t kw_args;
3560
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3561
switch (pos_args) {
3562
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3563
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3564
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3565
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3566
case 0: break;
3567
default: goto __pyx_L5_argtuple_error;
3568
}
3569
kw_args = PyDict_Size(__pyx_kwds);
3570
switch (pos_args) {
3571
case 0:
3572
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
3573
else goto __pyx_L5_argtuple_error;
3574
case 1:
3575
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
3576
else {
3577
__Pyx_RaiseArgtupleInvalid("non_surjective_primes", 0, 2, 4, 1); __PYX_ERR(0, 156, __pyx_L3_error)
3578
}
3579
case 2:
3580
if (kw_args > 0) {
3581
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min);
3582
if (value) { values[2] = value; kw_args--; }
3583
}
3584
case 3:
3585
if (kw_args > 0) {
3586
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max);
3587
if (value) { values[3] = value; kw_args--; }
3588
}
3589
}
3590
if (unlikely(kw_args > 0)) {
3591
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "non_surjective_primes") < 0)) __PYX_ERR(0, 156, __pyx_L3_error)
3592
}
3593
} else {
3594
switch (PyTuple_GET_SIZE(__pyx_args)) {
3595
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3596
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3597
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3598
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3599
break;
3600
default: goto __pyx_L5_argtuple_error;
3601
}
3602
}
3603
__pyx_v_A = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)values[0]);
3604
__pyx_v_B = ((struct __pyx_obj_4sage_5rings_7integer_Integer *)values[1]);
3605
if (values[2]) {
3606
__pyx_v_min = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_min == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error)
3607
} else {
3608
__pyx_v_min = ((int)2);
3609
}
3610
if (values[3]) {
3611
__pyx_v_max = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L3_error)
3612
} else {
3613
__pyx_v_max = ((int)59);
3614
}
3615
}
3616
goto __pyx_L4_argument_unpacking_done;
3617
__pyx_L5_argtuple_error:;
3618
__Pyx_RaiseArgtupleInvalid("non_surjective_primes", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __pyx_L3_error)
3619
__pyx_L3_error:;
3620
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.non_surjective_primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
3621
__Pyx_RefNannyFinishContext();
3622
return NULL;
3623
__pyx_L4_argument_unpacking_done:;
3624
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_4sage_5rings_7integer_Integer, 1, "A", 0))) __PYX_ERR(0, 156, __pyx_L1_error)
3625
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_4sage_5rings_7integer_Integer, 1, "B", 0))) __PYX_ERR(0, 156, __pyx_L1_error)
3626
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_6non_surjective_primes(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_min, __pyx_v_max);
3627
3628
/* function exit code */
3629
goto __pyx_L0;
3630
__pyx_L1_error:;
3631
__pyx_r = NULL;
3632
__pyx_L0:;
3633
__Pyx_RefNannyFinishContext();
3634
return __pyx_r;
3635
}
3636
3637
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_6non_surjective_primes(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_A, struct __pyx_obj_4sage_5rings_7integer_Integer *__pyx_v_B, int __pyx_v_min, int __pyx_v_max) {
3638
int __pyx_v_a;
3639
int __pyx_v_i;
3640
int __pyx_v_j;
3641
PyObject *__pyx_v_v = NULL;
3642
PyObject *__pyx_r = NULL;
3643
__Pyx_RefNannyDeclarations
3644
int __pyx_t_1;
3645
PyObject *__pyx_t_2 = NULL;
3646
PyObject *__pyx_t_3 = NULL;
3647
Py_ssize_t __pyx_t_4;
3648
int __pyx_t_5;
3649
int __pyx_t_6;
3650
__Pyx_RefNannySetupContext("non_surjective_primes", 0);
3651
3652
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":182
3653
* [5]
3654
* """
3655
* if min >= max: # <<<<<<<<<<<<<<
3656
* raise ValueError, "max must be bigger than min"
3657
* cdef int a = galrep_ec_non_surjective (min, max, A.value, B.value, 0)
3658
*/
3659
__pyx_t_1 = ((__pyx_v_min >= __pyx_v_max) != 0);
3660
if (__pyx_t_1) {
3661
3662
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":183
3663
* """
3664
* if min >= max:
3665
* raise ValueError, "max must be bigger than min" # <<<<<<<<<<<<<<
3666
* cdef int a = galrep_ec_non_surjective (min, max, A.value, B.value, 0)
3667
* if a == -1: raise ValueError, "min and max must be <= %s"%GALREP_MAX_ELL
3668
*/
3669
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_max_must_be_bigger_than_min, 0, 0);
3670
__PYX_ERR(0, 183, __pyx_L1_error)
3671
3672
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":182
3673
* [5]
3674
* """
3675
* if min >= max: # <<<<<<<<<<<<<<
3676
* raise ValueError, "max must be bigger than min"
3677
* cdef int a = galrep_ec_non_surjective (min, max, A.value, B.value, 0)
3678
*/
3679
}
3680
3681
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":184
3682
* if min >= max:
3683
* raise ValueError, "max must be bigger than min"
3684
* cdef int a = galrep_ec_non_surjective (min, max, A.value, B.value, 0) # <<<<<<<<<<<<<<
3685
* if a == -1: raise ValueError, "min and max must be <= %s"%GALREP_MAX_ELL
3686
* cdef int i, j=1
3687
*/
3688
__pyx_v_a = galrep_ec_non_surjective(__pyx_v_min, __pyx_v_max, __pyx_v_A->value, __pyx_v_B->value, 0);
3689
3690
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":185
3691
* raise ValueError, "max must be bigger than min"
3692
* cdef int a = galrep_ec_non_surjective (min, max, A.value, B.value, 0)
3693
* if a == -1: raise ValueError, "min and max must be <= %s"%GALREP_MAX_ELL # <<<<<<<<<<<<<<
3694
* cdef int i, j=1
3695
* v = []
3696
*/
3697
__pyx_t_1 = ((__pyx_v_a == -1L) != 0);
3698
if (__pyx_t_1) {
3699
__pyx_t_2 = __Pyx_PyInt_From_int(GALREP_MAX_ELL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
3700
__Pyx_GOTREF(__pyx_t_2);
3701
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_min_and_max_must_be_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
3702
__Pyx_GOTREF(__pyx_t_3);
3703
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3704
__Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_3, 0, 0);
3705
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3706
__PYX_ERR(0, 185, __pyx_L1_error)
3707
}
3708
3709
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":186
3710
* cdef int a = galrep_ec_non_surjective (min, max, A.value, B.value, 0)
3711
* if a == -1: raise ValueError, "min and max must be <= %s"%GALREP_MAX_ELL
3712
* cdef int i, j=1 # <<<<<<<<<<<<<<
3713
* v = []
3714
* for i in range(len(self.primes)):
3715
*/
3716
__pyx_v_j = 1;
3717
3718
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":187
3719
* if a == -1: raise ValueError, "min and max must be <= %s"%GALREP_MAX_ELL
3720
* cdef int i, j=1
3721
* v = [] # <<<<<<<<<<<<<<
3722
* for i in range(len(self.primes)):
3723
* if a & j:
3724
*/
3725
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error)
3726
__Pyx_GOTREF(__pyx_t_3);
3727
__pyx_v_v = ((PyObject*)__pyx_t_3);
3728
__pyx_t_3 = 0;
3729
3730
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":188
3731
* cdef int i, j=1
3732
* v = []
3733
* for i in range(len(self.primes)): # <<<<<<<<<<<<<<
3734
* if a & j:
3735
* v.append(self.primes[i])
3736
*/
3737
__pyx_t_3 = __pyx_v_self->primes;
3738
__Pyx_INCREF(__pyx_t_3);
3739
__pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 188, __pyx_L1_error)
3740
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3741
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
3742
__pyx_v_i = __pyx_t_5;
3743
3744
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":189
3745
* v = []
3746
* for i in range(len(self.primes)):
3747
* if a & j: # <<<<<<<<<<<<<<
3748
* v.append(self.primes[i])
3749
* j = j << 1
3750
*/
3751
__pyx_t_1 = ((__pyx_v_a & __pyx_v_j) != 0);
3752
if (__pyx_t_1) {
3753
3754
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":190
3755
* for i in range(len(self.primes)):
3756
* if a & j:
3757
* v.append(self.primes[i]) # <<<<<<<<<<<<<<
3758
* j = j << 1
3759
* return v
3760
*/
3761
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_self->primes, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error)
3762
__Pyx_GOTREF(__pyx_t_3);
3763
__pyx_t_6 = __Pyx_PyList_Append(__pyx_v_v, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 190, __pyx_L1_error)
3764
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3765
3766
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":189
3767
* v = []
3768
* for i in range(len(self.primes)):
3769
* if a & j: # <<<<<<<<<<<<<<
3770
* v.append(self.primes[i])
3771
* j = j << 1
3772
*/
3773
}
3774
3775
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":191
3776
* if a & j:
3777
* v.append(self.primes[i])
3778
* j = j << 1 # <<<<<<<<<<<<<<
3779
* return v
3780
*
3781
*/
3782
__pyx_v_j = (__pyx_v_j << 1);
3783
}
3784
3785
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":192
3786
* v.append(self.primes[i])
3787
* j = j << 1
3788
* return v # <<<<<<<<<<<<<<
3789
*
3790
* def __repr__(self):
3791
*/
3792
__Pyx_XDECREF(__pyx_r);
3793
__Pyx_INCREF(__pyx_v_v);
3794
__pyx_r = __pyx_v_v;
3795
goto __pyx_L0;
3796
3797
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":156
3798
* return v
3799
*
3800
* def non_surjective_primes(self, Integer A, Integer B, int min=2, int max=59): # <<<<<<<<<<<<<<
3801
* """
3802
* Returns a list of the primes ell in the interval [min, max]
3803
*/
3804
3805
/* function exit code */
3806
__pyx_L1_error:;
3807
__Pyx_XDECREF(__pyx_t_2);
3808
__Pyx_XDECREF(__pyx_t_3);
3809
__Pyx_AddTraceback("code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep.non_surjective_primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
3810
__pyx_r = NULL;
3811
__pyx_L0:;
3812
__Pyx_XDECREF(__pyx_v_v);
3813
__Pyx_XGIVEREF(__pyx_r);
3814
__Pyx_RefNannyFinishContext();
3815
return __pyx_r;
3816
}
3817
3818
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":194
3819
* return v
3820
*
3821
* def __repr__(self): # <<<<<<<<<<<<<<
3822
* """
3823
* EXAMPLES::
3824
*/
3825
3826
/* Python wrapper */
3827
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_9__repr__(PyObject *__pyx_v_self); /*proto*/
3828
static char __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__[] = "File: wrapper.pyx (starting at line 194)\n\n EXAMPLES::\n\n sage: from psage.ellcurve.galrep import GalRep\n sage: GalRep().__repr__()\n \"Andrew Sutherland's Probabilistic Image of Galois Algorithm\"\n ";
3829
#if CYTHON_COMPILING_IN_CPYTHON
3830
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__;
3831
#endif
3832
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_9__repr__(PyObject *__pyx_v_self) {
3833
PyObject *__pyx_r = 0;
3834
__Pyx_RefNannyDeclarations
3835
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
3836
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__(((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)__pyx_v_self));
3837
3838
/* function exit code */
3839
__Pyx_RefNannyFinishContext();
3840
return __pyx_r;
3841
}
3842
3843
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *__pyx_v_self) {
3844
PyObject *__pyx_r = NULL;
3845
__Pyx_RefNannyDeclarations
3846
__Pyx_RefNannySetupContext("__repr__", 0);
3847
3848
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":202
3849
* "Andrew Sutherland's Probabilistic Image of Galois Algorithm"
3850
* """
3851
* return "Andrew Sutherland's Probabilistic Image of Galois Algorithm" # <<<<<<<<<<<<<<
3852
*
3853
*
3854
*/
3855
__Pyx_XDECREF(__pyx_r);
3856
__Pyx_INCREF(__pyx_kp_s_Andrew_Sutherland_s_Probabilisti);
3857
__pyx_r = __pyx_kp_s_Andrew_Sutherland_s_Probabilisti;
3858
goto __pyx_L0;
3859
3860
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":194
3861
* return v
3862
*
3863
* def __repr__(self): # <<<<<<<<<<<<<<
3864
* """
3865
* EXAMPLES::
3866
*/
3867
3868
/* function exit code */
3869
__pyx_L0:;
3870
__Pyx_XGIVEREF(__pyx_r);
3871
__Pyx_RefNannyFinishContext();
3872
return __pyx_r;
3873
}
3874
3875
/* "sage/structure/element.pxd":7
3876
*
3877
*
3878
* cpdef inline parent(x): # <<<<<<<<<<<<<<
3879
* """
3880
* Return the parent of the element ``x``.
3881
*/
3882
3883
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
3884
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
3885
PyObject *__pyx_v_p = NULL;
3886
PyObject *__pyx_r = NULL;
3887
__Pyx_RefNannyDeclarations
3888
int __pyx_t_1;
3889
int __pyx_t_2;
3890
PyObject *__pyx_t_3 = NULL;
3891
PyObject *__pyx_t_4 = NULL;
3892
PyObject *__pyx_t_5 = NULL;
3893
PyObject *__pyx_t_6 = NULL;
3894
PyObject *__pyx_t_7 = NULL;
3895
PyObject *__pyx_t_8 = NULL;
3896
int __pyx_t_9;
3897
__Pyx_RefNannySetupContext("parent", 0);
3898
3899
/* "sage/structure/element.pxd":63
3900
* <... 'list'>
3901
* """
3902
* if isinstance(x, Element): # <<<<<<<<<<<<<<
3903
* return (<Element>x)._parent
3904
* # Fast check for "number" types, including int and float
3905
*/
3906
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, __pyx_ptype_4sage_9structure_7element_Element);
3907
__pyx_t_2 = (__pyx_t_1 != 0);
3908
if (__pyx_t_2) {
3909
3910
/* "sage/structure/element.pxd":64
3911
* """
3912
* if isinstance(x, Element):
3913
* return (<Element>x)._parent # <<<<<<<<<<<<<<
3914
* # Fast check for "number" types, including int and float
3915
* if PyNumber_Check(x):
3916
*/
3917
__Pyx_XDECREF(__pyx_r);
3918
__Pyx_INCREF(((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent));
3919
__pyx_r = ((PyObject *)((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_x)->_parent);
3920
goto __pyx_L0;
3921
3922
/* "sage/structure/element.pxd":63
3923
* <... 'list'>
3924
* """
3925
* if isinstance(x, Element): # <<<<<<<<<<<<<<
3926
* return (<Element>x)._parent
3927
* # Fast check for "number" types, including int and float
3928
*/
3929
}
3930
3931
/* "sage/structure/element.pxd":66
3932
* return (<Element>x)._parent
3933
* # Fast check for "number" types, including int and float
3934
* if PyNumber_Check(x): # <<<<<<<<<<<<<<
3935
* return type(x)
3936
* try:
3937
*/
3938
__pyx_t_2 = (PyNumber_Check(__pyx_v_x) != 0);
3939
if (__pyx_t_2) {
3940
3941
/* "sage/structure/element.pxd":67
3942
* # Fast check for "number" types, including int and float
3943
* if PyNumber_Check(x):
3944
* return type(x) # <<<<<<<<<<<<<<
3945
* try:
3946
* p = x.parent
3947
*/
3948
__Pyx_XDECREF(__pyx_r);
3949
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
3950
__pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
3951
goto __pyx_L0;
3952
3953
/* "sage/structure/element.pxd":66
3954
* return (<Element>x)._parent
3955
* # Fast check for "number" types, including int and float
3956
* if PyNumber_Check(x): # <<<<<<<<<<<<<<
3957
* return type(x)
3958
* try:
3959
*/
3960
}
3961
3962
/* "sage/structure/element.pxd":68
3963
* if PyNumber_Check(x):
3964
* return type(x)
3965
* try: # <<<<<<<<<<<<<<
3966
* p = x.parent
3967
* except AttributeError:
3968
*/
3969
{
3970
__Pyx_PyThreadState_declare
3971
__Pyx_PyThreadState_assign
3972
__Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
3973
__Pyx_XGOTREF(__pyx_t_3);
3974
__Pyx_XGOTREF(__pyx_t_4);
3975
__Pyx_XGOTREF(__pyx_t_5);
3976
/*try:*/ {
3977
3978
/* "sage/structure/element.pxd":69
3979
* return type(x)
3980
* try:
3981
* p = x.parent # <<<<<<<<<<<<<<
3982
* except AttributeError:
3983
* return type(x)
3984
*/
3985
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_parent); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 69, __pyx_L5_error)
3986
__Pyx_GOTREF(__pyx_t_6);
3987
__pyx_v_p = __pyx_t_6;
3988
__pyx_t_6 = 0;
3989
3990
/* "sage/structure/element.pxd":68
3991
* if PyNumber_Check(x):
3992
* return type(x)
3993
* try: # <<<<<<<<<<<<<<
3994
* p = x.parent
3995
* except AttributeError:
3996
*/
3997
}
3998
3999
/* "sage/structure/element.pxd":73
4000
* return type(x)
4001
* else:
4002
* return p() # <<<<<<<<<<<<<<
4003
*
4004
*
4005
*/
4006
/*else:*/ {
4007
__Pyx_XDECREF(__pyx_r);
4008
__Pyx_INCREF(__pyx_v_p);
4009
__pyx_t_7 = __pyx_v_p; __pyx_t_8 = NULL;
4010
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
4011
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
4012
if (likely(__pyx_t_8)) {
4013
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
4014
__Pyx_INCREF(__pyx_t_8);
4015
__Pyx_INCREF(function);
4016
__Pyx_DECREF_SET(__pyx_t_7, function);
4017
}
4018
}
4019
if (__pyx_t_8) {
4020
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 73, __pyx_L7_except_error)
4021
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4022
} else {
4023
__pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 73, __pyx_L7_except_error)
4024
}
4025
__Pyx_GOTREF(__pyx_t_6);
4026
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4027
__pyx_r = __pyx_t_6;
4028
__pyx_t_6 = 0;
4029
goto __pyx_L8_except_return;
4030
}
4031
__pyx_L5_error:;
4032
__Pyx_PyThreadState_assign
4033
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4034
4035
/* "sage/structure/element.pxd":70
4036
* try:
4037
* p = x.parent
4038
* except AttributeError: # <<<<<<<<<<<<<<
4039
* return type(x)
4040
* else:
4041
*/
4042
__pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
4043
if (__pyx_t_9) {
4044
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4045
if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 70, __pyx_L7_except_error)
4046
__Pyx_GOTREF(__pyx_t_6);
4047
__Pyx_GOTREF(__pyx_t_7);
4048
__Pyx_GOTREF(__pyx_t_8);
4049
4050
/* "sage/structure/element.pxd":71
4051
* p = x.parent
4052
* except AttributeError:
4053
* return type(x) # <<<<<<<<<<<<<<
4054
* else:
4055
* return p()
4056
*/
4057
__Pyx_XDECREF(__pyx_r);
4058
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x)));
4059
__pyx_r = ((PyObject *)Py_TYPE(__pyx_v_x));
4060
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4061
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4062
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4063
goto __pyx_L8_except_return;
4064
}
4065
goto __pyx_L7_except_error;
4066
__pyx_L7_except_error:;
4067
4068
/* "sage/structure/element.pxd":68
4069
* if PyNumber_Check(x):
4070
* return type(x)
4071
* try: # <<<<<<<<<<<<<<
4072
* p = x.parent
4073
* except AttributeError:
4074
*/
4075
__Pyx_PyThreadState_assign
4076
__Pyx_XGIVEREF(__pyx_t_3);
4077
__Pyx_XGIVEREF(__pyx_t_4);
4078
__Pyx_XGIVEREF(__pyx_t_5);
4079
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
4080
goto __pyx_L1_error;
4081
__pyx_L8_except_return:;
4082
__Pyx_PyThreadState_assign
4083
__Pyx_XGIVEREF(__pyx_t_3);
4084
__Pyx_XGIVEREF(__pyx_t_4);
4085
__Pyx_XGIVEREF(__pyx_t_5);
4086
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
4087
goto __pyx_L0;
4088
}
4089
4090
/* "sage/structure/element.pxd":7
4091
*
4092
*
4093
* cpdef inline parent(x): # <<<<<<<<<<<<<<
4094
* """
4095
* Return the parent of the element ``x``.
4096
*/
4097
4098
/* function exit code */
4099
__pyx_L1_error:;
4100
__Pyx_XDECREF(__pyx_t_6);
4101
__Pyx_XDECREF(__pyx_t_7);
4102
__Pyx_XDECREF(__pyx_t_8);
4103
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4104
__pyx_r = 0;
4105
__pyx_L0:;
4106
__Pyx_XDECREF(__pyx_v_p);
4107
__Pyx_XGIVEREF(__pyx_r);
4108
__Pyx_RefNannyFinishContext();
4109
return __pyx_r;
4110
}
4111
4112
/* Python wrapper */
4113
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
4114
static char __pyx_doc_4sage_9structure_7element_parent[] = "File: (starting at line 7)\n\n Return the parent of the element ``x``.\n\n Usually, this means the mathematical object of which ``x`` is an\n element.\n\n INPUT:\n\n - ``x`` -- an element\n\n OUTPUT:\n\n - If ``x`` is a Sage :class:`Element`, return ``x.parent()``.\n\n - If ``x`` has a ``parent`` method and ``x`` does not have an\n ``__int__`` or ``__float__`` method, return ``x.parent()``.\n\n - Otherwise, return ``type(x)``.\n\n .. SEEALSO::\n\n `Parents, Conversion and Coercion <http://doc.sagemath.org/html/en/tutorial/tour_coercion.html>`_\n Section in the Sage Tutorial\n\n EXAMPLES::\n\n sage: a = 42\n sage: parent(a)\n Integer Ring\n sage: b = 42/1\n sage: parent(b)\n Rational Field\n sage: c = 42.0\n sage: parent(c)\n Real Field with 53 bits of precision\n\n Some more complicated examples::\n\n sage: x = Partition([3,2,1,1,1])\n sage: parent(x)\n Partitions\n sage: v = vector(RDF, [1,2,3])\n sage: parent(v)\n Vector space of dimension 3 over Real Double Field\n\n The following are not considered to be elements, so the type is\n returned::\n\n sage: d = int(42) # Python int\n sage: parent(d)\n <type 'int'>\n sage: L = list(range(10))\n sage: parent(L)\n <... 'list'>\n ";
4115
static PyObject *__pyx_pw_4sage_9structure_7element_1parent(PyObject *__pyx_self, PyObject *__pyx_v_x) {
4116
PyObject *__pyx_r = 0;
4117
__Pyx_RefNannyDeclarations
4118
__Pyx_RefNannySetupContext("parent (wrapper)", 0);
4119
__pyx_r = __pyx_pf_4sage_9structure_7element_parent(__pyx_self, ((PyObject *)__pyx_v_x));
4120
4121
/* function exit code */
4122
__Pyx_RefNannyFinishContext();
4123
return __pyx_r;
4124
}
4125
4126
static PyObject *__pyx_pf_4sage_9structure_7element_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
4127
PyObject *__pyx_r = NULL;
4128
__Pyx_RefNannyDeclarations
4129
PyObject *__pyx_t_1 = NULL;
4130
__Pyx_RefNannySetupContext("parent", 0);
4131
__Pyx_XDECREF(__pyx_r);
4132
__pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error)
4133
__Pyx_GOTREF(__pyx_t_1);
4134
__pyx_r = __pyx_t_1;
4135
__pyx_t_1 = 0;
4136
goto __pyx_L0;
4137
4138
/* function exit code */
4139
__pyx_L1_error:;
4140
__Pyx_XDECREF(__pyx_t_1);
4141
__Pyx_AddTraceback("sage.structure.element.parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4142
__pyx_r = NULL;
4143
__pyx_L0:;
4144
__Pyx_XGIVEREF(__pyx_r);
4145
__Pyx_RefNannyFinishContext();
4146
return __pyx_r;
4147
}
4148
4149
/* "sage/structure/element.pxd":76
4150
*
4151
*
4152
* cdef inline int classify_elements(left, right): # <<<<<<<<<<<<<<
4153
* """
4154
* Given two objects, at least one which is an :class:`Element`,
4155
*/
4156
4157
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_classify_elements(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
4158
int __pyx_r;
4159
__Pyx_RefNannyDeclarations
4160
int __pyx_t_1;
4161
int __pyx_t_2;
4162
__Pyx_RefNannySetupContext("classify_elements", 0);
4163
4164
/* "sage/structure/element.pxd":99
4165
* - 0o37: both are Element, same type, same parent
4166
* """
4167
* if type(left) is type(right): # <<<<<<<<<<<<<<
4168
* # We know at least one of the arguments is an Element. So if
4169
* # their types are *equal* (fast to check) then they are both
4170
*/
4171
__pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_left)) == ((PyObject *)Py_TYPE(__pyx_v_right)));
4172
__pyx_t_2 = (__pyx_t_1 != 0);
4173
if (__pyx_t_2) {
4174
4175
/* "sage/structure/element.pxd":103
4176
* # their types are *equal* (fast to check) then they are both
4177
* # Elements.
4178
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
4179
* return 0o37
4180
* else:
4181
*/
4182
__pyx_t_2 = (((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_left)->_parent == ((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_right)->_parent);
4183
__pyx_t_1 = (__pyx_t_2 != 0);
4184
if (__pyx_t_1) {
4185
4186
/* "sage/structure/element.pxd":104
4187
* # Elements.
4188
* if (<Element>left)._parent is (<Element>right)._parent:
4189
* return 0o37 # <<<<<<<<<<<<<<
4190
* else:
4191
* return 0o17
4192
*/
4193
__pyx_r = 037;
4194
goto __pyx_L0;
4195
4196
/* "sage/structure/element.pxd":103
4197
* # their types are *equal* (fast to check) then they are both
4198
* # Elements.
4199
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
4200
* return 0o37
4201
* else:
4202
*/
4203
}
4204
4205
/* "sage/structure/element.pxd":106
4206
* return 0o37
4207
* else:
4208
* return 0o17 # <<<<<<<<<<<<<<
4209
* if not isinstance(right, Element):
4210
* return 0o01
4211
*/
4212
/*else*/ {
4213
__pyx_r = 017;
4214
goto __pyx_L0;
4215
}
4216
4217
/* "sage/structure/element.pxd":99
4218
* - 0o37: both are Element, same type, same parent
4219
* """
4220
* if type(left) is type(right): # <<<<<<<<<<<<<<
4221
* # We know at least one of the arguments is an Element. So if
4222
* # their types are *equal* (fast to check) then they are both
4223
*/
4224
}
4225
4226
/* "sage/structure/element.pxd":107
4227
* else:
4228
* return 0o17
4229
* if not isinstance(right, Element): # <<<<<<<<<<<<<<
4230
* return 0o01
4231
* if not isinstance(left, Element):
4232
*/
4233
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_right, __pyx_ptype_4sage_9structure_7element_Element);
4234
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
4235
if (__pyx_t_2) {
4236
4237
/* "sage/structure/element.pxd":108
4238
* return 0o17
4239
* if not isinstance(right, Element):
4240
* return 0o01 # <<<<<<<<<<<<<<
4241
* if not isinstance(left, Element):
4242
* return 0o02
4243
*/
4244
__pyx_r = 001;
4245
goto __pyx_L0;
4246
4247
/* "sage/structure/element.pxd":107
4248
* else:
4249
* return 0o17
4250
* if not isinstance(right, Element): # <<<<<<<<<<<<<<
4251
* return 0o01
4252
* if not isinstance(left, Element):
4253
*/
4254
}
4255
4256
/* "sage/structure/element.pxd":109
4257
* if not isinstance(right, Element):
4258
* return 0o01
4259
* if not isinstance(left, Element): # <<<<<<<<<<<<<<
4260
* return 0o02
4261
* if (<Element>left)._parent is (<Element>right)._parent:
4262
*/
4263
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_left, __pyx_ptype_4sage_9structure_7element_Element);
4264
__pyx_t_1 = ((!(__pyx_t_2 != 0)) != 0);
4265
if (__pyx_t_1) {
4266
4267
/* "sage/structure/element.pxd":110
4268
* return 0o01
4269
* if not isinstance(left, Element):
4270
* return 0o02 # <<<<<<<<<<<<<<
4271
* if (<Element>left)._parent is (<Element>right)._parent:
4272
* return 0o27
4273
*/
4274
__pyx_r = 002;
4275
goto __pyx_L0;
4276
4277
/* "sage/structure/element.pxd":109
4278
* if not isinstance(right, Element):
4279
* return 0o01
4280
* if not isinstance(left, Element): # <<<<<<<<<<<<<<
4281
* return 0o02
4282
* if (<Element>left)._parent is (<Element>right)._parent:
4283
*/
4284
}
4285
4286
/* "sage/structure/element.pxd":111
4287
* if not isinstance(left, Element):
4288
* return 0o02
4289
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
4290
* return 0o27
4291
* else:
4292
*/
4293
__pyx_t_1 = (((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_left)->_parent == ((struct __pyx_obj_4sage_9structure_7element_Element *)__pyx_v_right)->_parent);
4294
__pyx_t_2 = (__pyx_t_1 != 0);
4295
if (__pyx_t_2) {
4296
4297
/* "sage/structure/element.pxd":112
4298
* return 0o02
4299
* if (<Element>left)._parent is (<Element>right)._parent:
4300
* return 0o27 # <<<<<<<<<<<<<<
4301
* else:
4302
* return 0o07
4303
*/
4304
__pyx_r = 027;
4305
goto __pyx_L0;
4306
4307
/* "sage/structure/element.pxd":111
4308
* if not isinstance(left, Element):
4309
* return 0o02
4310
* if (<Element>left)._parent is (<Element>right)._parent: # <<<<<<<<<<<<<<
4311
* return 0o27
4312
* else:
4313
*/
4314
}
4315
4316
/* "sage/structure/element.pxd":114
4317
* return 0o27
4318
* else:
4319
* return 0o07 # <<<<<<<<<<<<<<
4320
*
4321
* # Functions to help understand the result of classify_elements()
4322
*/
4323
/*else*/ {
4324
__pyx_r = 007;
4325
goto __pyx_L0;
4326
}
4327
4328
/* "sage/structure/element.pxd":76
4329
*
4330
*
4331
* cdef inline int classify_elements(left, right): # <<<<<<<<<<<<<<
4332
* """
4333
* Given two objects, at least one which is an :class:`Element`,
4334
*/
4335
4336
/* function exit code */
4337
__pyx_L0:;
4338
__Pyx_RefNannyFinishContext();
4339
return __pyx_r;
4340
}
4341
4342
/* "sage/structure/element.pxd":117
4343
*
4344
* # Functions to help understand the result of classify_elements()
4345
* cdef inline bint BOTH_ARE_ELEMENT(int cl): # <<<<<<<<<<<<<<
4346
* return cl & 0o04
4347
* cdef inline bint HAVE_SAME_PARENT(int cl):
4348
*/
4349
4350
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_BOTH_ARE_ELEMENT(int __pyx_v_cl) {
4351
int __pyx_r;
4352
__Pyx_RefNannyDeclarations
4353
__Pyx_RefNannySetupContext("BOTH_ARE_ELEMENT", 0);
4354
4355
/* "sage/structure/element.pxd":118
4356
* # Functions to help understand the result of classify_elements()
4357
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
4358
* return cl & 0o04 # <<<<<<<<<<<<<<
4359
* cdef inline bint HAVE_SAME_PARENT(int cl):
4360
* return cl & 0o20
4361
*/
4362
__pyx_r = (__pyx_v_cl & 004);
4363
goto __pyx_L0;
4364
4365
/* "sage/structure/element.pxd":117
4366
*
4367
* # Functions to help understand the result of classify_elements()
4368
* cdef inline bint BOTH_ARE_ELEMENT(int cl): # <<<<<<<<<<<<<<
4369
* return cl & 0o04
4370
* cdef inline bint HAVE_SAME_PARENT(int cl):
4371
*/
4372
4373
/* function exit code */
4374
__pyx_L0:;
4375
__Pyx_RefNannyFinishContext();
4376
return __pyx_r;
4377
}
4378
4379
/* "sage/structure/element.pxd":119
4380
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
4381
* return cl & 0o04
4382
* cdef inline bint HAVE_SAME_PARENT(int cl): # <<<<<<<<<<<<<<
4383
* return cl & 0o20
4384
*
4385
*/
4386
4387
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(int __pyx_v_cl) {
4388
int __pyx_r;
4389
__Pyx_RefNannyDeclarations
4390
__Pyx_RefNannySetupContext("HAVE_SAME_PARENT", 0);
4391
4392
/* "sage/structure/element.pxd":120
4393
* return cl & 0o04
4394
* cdef inline bint HAVE_SAME_PARENT(int cl):
4395
* return cl & 0o20 # <<<<<<<<<<<<<<
4396
*
4397
*
4398
*/
4399
__pyx_r = (__pyx_v_cl & 020);
4400
goto __pyx_L0;
4401
4402
/* "sage/structure/element.pxd":119
4403
* cdef inline bint BOTH_ARE_ELEMENT(int cl):
4404
* return cl & 0o04
4405
* cdef inline bint HAVE_SAME_PARENT(int cl): # <<<<<<<<<<<<<<
4406
* return cl & 0o20
4407
*
4408
*/
4409
4410
/* function exit code */
4411
__pyx_L0:;
4412
__Pyx_RefNannyFinishContext();
4413
return __pyx_r;
4414
}
4415
4416
/* "sage/structure/element.pxd":123
4417
*
4418
*
4419
* cpdef inline bint have_same_parent(left, right): # <<<<<<<<<<<<<<
4420
* """
4421
* Return ``True`` if and only if ``left`` and ``right`` have the
4422
*/
4423
4424
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4425
static CYTHON_INLINE int __pyx_f_4sage_9structure_7element_have_same_parent(PyObject *__pyx_v_left, PyObject *__pyx_v_right, CYTHON_UNUSED int __pyx_skip_dispatch) {
4426
int __pyx_r;
4427
__Pyx_RefNannyDeclarations
4428
__Pyx_RefNannySetupContext("have_same_parent", 0);
4429
4430
/* "sage/structure/element.pxd":155
4431
* True
4432
* """
4433
* return HAVE_SAME_PARENT(classify_elements(left, right)) # <<<<<<<<<<<<<<
4434
*
4435
*
4436
*/
4437
__pyx_r = __pyx_f_4sage_9structure_7element_HAVE_SAME_PARENT(__pyx_f_4sage_9structure_7element_classify_elements(__pyx_v_left, __pyx_v_right));
4438
goto __pyx_L0;
4439
4440
/* "sage/structure/element.pxd":123
4441
*
4442
*
4443
* cpdef inline bint have_same_parent(left, right): # <<<<<<<<<<<<<<
4444
* """
4445
* Return ``True`` if and only if ``left`` and ``right`` have the
4446
*/
4447
4448
/* function exit code */
4449
__pyx_L0:;
4450
__Pyx_RefNannyFinishContext();
4451
return __pyx_r;
4452
}
4453
4454
/* Python wrapper */
4455
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4456
static char __pyx_doc_4sage_9structure_7element_2have_same_parent[] = "File: (starting at line 123)\n\n Return ``True`` if and only if ``left`` and ``right`` have the\n same parent.\n\n .. WARNING::\n\n This function assumes that at least one of the arguments is a\n Sage :class:`Element`. When in doubt, use the slower\n ``parent(left) is parent(right)`` instead.\n\n EXAMPLES::\n\n sage: from sage.structure.element import have_same_parent\n sage: have_same_parent(1, 3)\n True\n sage: have_same_parent(1, 1/2)\n False\n sage: have_same_parent(gap(1), gap(1/2))\n True\n\n These have different types but the same parent::\n\n sage: a = RLF(2)\n sage: b = exp(a)\n sage: type(a)\n <type 'sage.rings.real_lazy.LazyWrapper'>\n sage: type(b)\n <type 'sage.rings.real_lazy.LazyNamedUnop'>\n sage: have_same_parent(a, b)\n True\n ";
4457
static PyObject *__pyx_pw_4sage_9structure_7element_3have_same_parent(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4458
PyObject *__pyx_v_left = 0;
4459
PyObject *__pyx_v_right = 0;
4460
PyObject *__pyx_r = 0;
4461
__Pyx_RefNannyDeclarations
4462
__Pyx_RefNannySetupContext("have_same_parent (wrapper)", 0);
4463
{
4464
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left,&__pyx_n_s_right,0};
4465
PyObject* values[2] = {0,0};
4466
if (unlikely(__pyx_kwds)) {
4467
Py_ssize_t kw_args;
4468
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4469
switch (pos_args) {
4470
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4471
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4472
case 0: break;
4473
default: goto __pyx_L5_argtuple_error;
4474
}
4475
kw_args = PyDict_Size(__pyx_kwds);
4476
switch (pos_args) {
4477
case 0:
4478
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
4479
else goto __pyx_L5_argtuple_error;
4480
case 1:
4481
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
4482
else {
4483
__Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, 1); __PYX_ERR(1, 123, __pyx_L3_error)
4484
}
4485
}
4486
if (unlikely(kw_args > 0)) {
4487
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "have_same_parent") < 0)) __PYX_ERR(1, 123, __pyx_L3_error)
4488
}
4489
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4490
goto __pyx_L5_argtuple_error;
4491
} else {
4492
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4493
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4494
}
4495
__pyx_v_left = values[0];
4496
__pyx_v_right = values[1];
4497
}
4498
goto __pyx_L4_argument_unpacking_done;
4499
__pyx_L5_argtuple_error:;
4500
__Pyx_RaiseArgtupleInvalid("have_same_parent", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 123, __pyx_L3_error)
4501
__pyx_L3_error:;
4502
__Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4503
__Pyx_RefNannyFinishContext();
4504
return NULL;
4505
__pyx_L4_argument_unpacking_done:;
4506
__pyx_r = __pyx_pf_4sage_9structure_7element_2have_same_parent(__pyx_self, __pyx_v_left, __pyx_v_right);
4507
4508
/* function exit code */
4509
__Pyx_RefNannyFinishContext();
4510
return __pyx_r;
4511
}
4512
4513
static PyObject *__pyx_pf_4sage_9structure_7element_2have_same_parent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
4514
PyObject *__pyx_r = NULL;
4515
__Pyx_RefNannyDeclarations
4516
PyObject *__pyx_t_1 = NULL;
4517
__Pyx_RefNannySetupContext("have_same_parent", 0);
4518
__Pyx_XDECREF(__pyx_r);
4519
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_7element_have_same_parent(__pyx_v_left, __pyx_v_right, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 123, __pyx_L1_error)
4520
__Pyx_GOTREF(__pyx_t_1);
4521
__pyx_r = __pyx_t_1;
4522
__pyx_t_1 = 0;
4523
goto __pyx_L0;
4524
4525
/* function exit code */
4526
__pyx_L1_error:;
4527
__Pyx_XDECREF(__pyx_t_1);
4528
__Pyx_AddTraceback("sage.structure.element.have_same_parent", __pyx_clineno, __pyx_lineno, __pyx_filename);
4529
__pyx_r = NULL;
4530
__pyx_L0:;
4531
__Pyx_XGIVEREF(__pyx_r);
4532
__Pyx_RefNannyFinishContext();
4533
return __pyx_r;
4534
}
4535
4536
/* "sage/structure/element.pxd":158
4537
*
4538
*
4539
* cdef inline parent_c(x): # <<<<<<<<<<<<<<
4540
* """
4541
* Deprecated alias for :func:`parent`.
4542
*/
4543
4544
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_7element_parent_c(PyObject *__pyx_v_x) {
4545
PyObject *__pyx_r = NULL;
4546
__Pyx_RefNannyDeclarations
4547
PyObject *__pyx_t_1 = NULL;
4548
__Pyx_RefNannySetupContext("parent_c", 0);
4549
4550
/* "sage/structure/element.pxd":162
4551
* Deprecated alias for :func:`parent`.
4552
* """
4553
* return parent(x) # <<<<<<<<<<<<<<
4554
*
4555
*
4556
*/
4557
__Pyx_XDECREF(__pyx_r);
4558
__pyx_t_1 = __pyx_f_4sage_9structure_7element_parent(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 162, __pyx_L1_error)
4559
__Pyx_GOTREF(__pyx_t_1);
4560
__pyx_r = __pyx_t_1;
4561
__pyx_t_1 = 0;
4562
goto __pyx_L0;
4563
4564
/* "sage/structure/element.pxd":158
4565
*
4566
*
4567
* cdef inline parent_c(x): # <<<<<<<<<<<<<<
4568
* """
4569
* Deprecated alias for :func:`parent`.
4570
*/
4571
4572
/* function exit code */
4573
__pyx_L1_error:;
4574
__Pyx_XDECREF(__pyx_t_1);
4575
__Pyx_AddTraceback("sage.structure.element.parent_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
4576
__pyx_r = 0;
4577
__pyx_L0:;
4578
__Pyx_XGIVEREF(__pyx_r);
4579
__Pyx_RefNannyFinishContext();
4580
return __pyx_r;
4581
}
4582
4583
/* "cysignals/memory.pxd":40
4584
*
4585
*
4586
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
4587
* sig_block()
4588
* cdef void* ret = malloc(n)
4589
*/
4590
4591
static CYTHON_INLINE void *sig_malloc(size_t __pyx_v_n) {
4592
void *__pyx_v_ret;
4593
void *__pyx_r;
4594
4595
/* "cysignals/memory.pxd":41
4596
*
4597
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
4598
* sig_block() # <<<<<<<<<<<<<<
4599
* cdef void* ret = malloc(n)
4600
* sig_unblock()
4601
*/
4602
sig_block();
4603
4604
/* "cysignals/memory.pxd":42
4605
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
4606
* sig_block()
4607
* cdef void* ret = malloc(n) # <<<<<<<<<<<<<<
4608
* sig_unblock()
4609
* return ret
4610
*/
4611
__pyx_v_ret = malloc(__pyx_v_n);
4612
4613
/* "cysignals/memory.pxd":43
4614
* sig_block()
4615
* cdef void* ret = malloc(n)
4616
* sig_unblock() # <<<<<<<<<<<<<<
4617
* return ret
4618
*
4619
*/
4620
sig_unblock();
4621
4622
/* "cysignals/memory.pxd":44
4623
* cdef void* ret = malloc(n)
4624
* sig_unblock()
4625
* return ret # <<<<<<<<<<<<<<
4626
*
4627
*
4628
*/
4629
__pyx_r = __pyx_v_ret;
4630
goto __pyx_L0;
4631
4632
/* "cysignals/memory.pxd":40
4633
*
4634
*
4635
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
4636
* sig_block()
4637
* cdef void* ret = malloc(n)
4638
*/
4639
4640
/* function exit code */
4641
__pyx_L0:;
4642
return __pyx_r;
4643
}
4644
4645
/* "cysignals/memory.pxd":47
4646
*
4647
*
4648
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
4649
* sig_block()
4650
* cdef void* ret = realloc(ptr, size)
4651
*/
4652
4653
static CYTHON_INLINE void *sig_realloc(void *__pyx_v_ptr, size_t __pyx_v_size) {
4654
void *__pyx_v_ret;
4655
void *__pyx_r;
4656
4657
/* "cysignals/memory.pxd":48
4658
*
4659
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
4660
* sig_block() # <<<<<<<<<<<<<<
4661
* cdef void* ret = realloc(ptr, size)
4662
* sig_unblock()
4663
*/
4664
sig_block();
4665
4666
/* "cysignals/memory.pxd":49
4667
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
4668
* sig_block()
4669
* cdef void* ret = realloc(ptr, size) # <<<<<<<<<<<<<<
4670
* sig_unblock()
4671
* return ret
4672
*/
4673
__pyx_v_ret = realloc(__pyx_v_ptr, __pyx_v_size);
4674
4675
/* "cysignals/memory.pxd":50
4676
* sig_block()
4677
* cdef void* ret = realloc(ptr, size)
4678
* sig_unblock() # <<<<<<<<<<<<<<
4679
* return ret
4680
*
4681
*/
4682
sig_unblock();
4683
4684
/* "cysignals/memory.pxd":51
4685
* cdef void* ret = realloc(ptr, size)
4686
* sig_unblock()
4687
* return ret # <<<<<<<<<<<<<<
4688
*
4689
*
4690
*/
4691
__pyx_r = __pyx_v_ret;
4692
goto __pyx_L0;
4693
4694
/* "cysignals/memory.pxd":47
4695
*
4696
*
4697
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
4698
* sig_block()
4699
* cdef void* ret = realloc(ptr, size)
4700
*/
4701
4702
/* function exit code */
4703
__pyx_L0:;
4704
return __pyx_r;
4705
}
4706
4707
/* "cysignals/memory.pxd":54
4708
*
4709
*
4710
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
4711
* sig_block()
4712
* cdef void* ret = calloc(nmemb, size)
4713
*/
4714
4715
static CYTHON_INLINE void *sig_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
4716
void *__pyx_v_ret;
4717
void *__pyx_r;
4718
4719
/* "cysignals/memory.pxd":55
4720
*
4721
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
4722
* sig_block() # <<<<<<<<<<<<<<
4723
* cdef void* ret = calloc(nmemb, size)
4724
* sig_unblock()
4725
*/
4726
sig_block();
4727
4728
/* "cysignals/memory.pxd":56
4729
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
4730
* sig_block()
4731
* cdef void* ret = calloc(nmemb, size) # <<<<<<<<<<<<<<
4732
* sig_unblock()
4733
* return ret
4734
*/
4735
__pyx_v_ret = calloc(__pyx_v_nmemb, __pyx_v_size);
4736
4737
/* "cysignals/memory.pxd":57
4738
* sig_block()
4739
* cdef void* ret = calloc(nmemb, size)
4740
* sig_unblock() # <<<<<<<<<<<<<<
4741
* return ret
4742
*
4743
*/
4744
sig_unblock();
4745
4746
/* "cysignals/memory.pxd":58
4747
* cdef void* ret = calloc(nmemb, size)
4748
* sig_unblock()
4749
* return ret # <<<<<<<<<<<<<<
4750
*
4751
*
4752
*/
4753
__pyx_r = __pyx_v_ret;
4754
goto __pyx_L0;
4755
4756
/* "cysignals/memory.pxd":54
4757
*
4758
*
4759
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
4760
* sig_block()
4761
* cdef void* ret = calloc(nmemb, size)
4762
*/
4763
4764
/* function exit code */
4765
__pyx_L0:;
4766
return __pyx_r;
4767
}
4768
4769
/* "cysignals/memory.pxd":61
4770
*
4771
*
4772
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
4773
* sig_block()
4774
* free(ptr)
4775
*/
4776
4777
static CYTHON_INLINE void sig_free(void *__pyx_v_ptr) {
4778
4779
/* "cysignals/memory.pxd":62
4780
*
4781
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
4782
* sig_block() # <<<<<<<<<<<<<<
4783
* free(ptr)
4784
* sig_unblock()
4785
*/
4786
sig_block();
4787
4788
/* "cysignals/memory.pxd":63
4789
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
4790
* sig_block()
4791
* free(ptr) # <<<<<<<<<<<<<<
4792
* sig_unblock()
4793
*
4794
*/
4795
free(__pyx_v_ptr);
4796
4797
/* "cysignals/memory.pxd":64
4798
* sig_block()
4799
* free(ptr)
4800
* sig_unblock() # <<<<<<<<<<<<<<
4801
*
4802
*
4803
*/
4804
sig_unblock();
4805
4806
/* "cysignals/memory.pxd":61
4807
*
4808
*
4809
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
4810
* sig_block()
4811
* free(ptr)
4812
*/
4813
4814
/* function exit code */
4815
}
4816
4817
/* "cysignals/memory.pxd":68
4818
*
4819
* @cython.cdivision(True)
4820
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
4821
* """
4822
* Return a*b, checking for overflow. Assume that a > 0.
4823
*/
4824
4825
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t __pyx_v_a, size_t __pyx_v_b) {
4826
size_t __pyx_v_MUL_NO_OVERFLOW;
4827
size_t __pyx_r;
4828
int __pyx_t_1;
4829
int __pyx_t_2;
4830
4831
/* "cysignals/memory.pxd":75
4832
* """
4833
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
4834
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t))) # <<<<<<<<<<<<<<
4835
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4836
* if unlikely(b > (<size_t>-1) // a):
4837
*/
4838
__pyx_v_MUL_NO_OVERFLOW = (((size_t)1) << (4 * (sizeof(size_t))));
4839
4840
/* "cysignals/memory.pxd":76
4841
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
4842
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4843
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
4844
* if unlikely(b > (<size_t>-1) // a):
4845
* return <size_t>(-1)
4846
*/
4847
__pyx_t_2 = ((__pyx_v_a >= __pyx_v_MUL_NO_OVERFLOW) != 0);
4848
if (!__pyx_t_2) {
4849
} else {
4850
__pyx_t_1 = __pyx_t_2;
4851
goto __pyx_L4_bool_binop_done;
4852
}
4853
__pyx_t_2 = ((__pyx_v_b >= __pyx_v_MUL_NO_OVERFLOW) != 0);
4854
__pyx_t_1 = __pyx_t_2;
4855
__pyx_L4_bool_binop_done:;
4856
if (__pyx_t_1) {
4857
4858
/* "cysignals/memory.pxd":77
4859
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4860
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4861
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
4862
* return <size_t>(-1)
4863
* return a*b
4864
*/
4865
__pyx_t_1 = (unlikely((__pyx_v_b > (((size_t)-1L) / __pyx_v_a))) != 0);
4866
if (__pyx_t_1) {
4867
4868
/* "cysignals/memory.pxd":78
4869
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4870
* if unlikely(b > (<size_t>-1) // a):
4871
* return <size_t>(-1) # <<<<<<<<<<<<<<
4872
* return a*b
4873
*
4874
*/
4875
__pyx_r = ((size_t)-1L);
4876
goto __pyx_L0;
4877
4878
/* "cysignals/memory.pxd":77
4879
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4880
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
4881
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
4882
* return <size_t>(-1)
4883
* return a*b
4884
*/
4885
}
4886
4887
/* "cysignals/memory.pxd":76
4888
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
4889
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
4890
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
4891
* if unlikely(b > (<size_t>-1) // a):
4892
* return <size_t>(-1)
4893
*/
4894
}
4895
4896
/* "cysignals/memory.pxd":79
4897
* if unlikely(b > (<size_t>-1) // a):
4898
* return <size_t>(-1)
4899
* return a*b # <<<<<<<<<<<<<<
4900
*
4901
*
4902
*/
4903
__pyx_r = (__pyx_v_a * __pyx_v_b);
4904
goto __pyx_L0;
4905
4906
/* "cysignals/memory.pxd":68
4907
*
4908
* @cython.cdivision(True)
4909
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
4910
* """
4911
* Return a*b, checking for overflow. Assume that a > 0.
4912
*/
4913
4914
/* function exit code */
4915
__pyx_L0:;
4916
return __pyx_r;
4917
}
4918
4919
/* "cysignals/memory.pxd":82
4920
*
4921
*
4922
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4923
* """
4924
* Allocate memory for ``nmemb`` elements of size ``size``.
4925
*/
4926
4927
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
4928
size_t __pyx_v_n;
4929
void *__pyx_v_ret;
4930
void *__pyx_r;
4931
__Pyx_RefNannyDeclarations
4932
int __pyx_t_1;
4933
PyObject *__pyx_t_2 = NULL;
4934
PyObject *__pyx_t_3 = NULL;
4935
PyObject *__pyx_t_4 = NULL;
4936
__Pyx_RefNannySetupContext("check_allocarray", 0);
4937
4938
/* "cysignals/memory.pxd":86
4939
* Allocate memory for ``nmemb`` elements of size ``size``.
4940
* """
4941
* if nmemb == 0: # <<<<<<<<<<<<<<
4942
* return NULL
4943
* cdef size_t n = mul_overflowcheck(nmemb, size)
4944
*/
4945
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
4946
if (__pyx_t_1) {
4947
4948
/* "cysignals/memory.pxd":87
4949
* """
4950
* if nmemb == 0:
4951
* return NULL # <<<<<<<<<<<<<<
4952
* cdef size_t n = mul_overflowcheck(nmemb, size)
4953
* cdef void* ret = sig_malloc(n)
4954
*/
4955
__pyx_r = NULL;
4956
goto __pyx_L0;
4957
4958
/* "cysignals/memory.pxd":86
4959
* Allocate memory for ``nmemb`` elements of size ``size``.
4960
* """
4961
* if nmemb == 0: # <<<<<<<<<<<<<<
4962
* return NULL
4963
* cdef size_t n = mul_overflowcheck(nmemb, size)
4964
*/
4965
}
4966
4967
/* "cysignals/memory.pxd":88
4968
* if nmemb == 0:
4969
* return NULL
4970
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
4971
* cdef void* ret = sig_malloc(n)
4972
* if unlikely(ret == NULL):
4973
*/
4974
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
4975
4976
/* "cysignals/memory.pxd":89
4977
* return NULL
4978
* cdef size_t n = mul_overflowcheck(nmemb, size)
4979
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
4980
* if unlikely(ret == NULL):
4981
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4982
*/
4983
__pyx_v_ret = sig_malloc(__pyx_v_n);
4984
4985
/* "cysignals/memory.pxd":90
4986
* cdef size_t n = mul_overflowcheck(nmemb, size)
4987
* cdef void* ret = sig_malloc(n)
4988
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4989
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4990
* return ret
4991
*/
4992
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
4993
if (__pyx_t_1) {
4994
4995
/* "cysignals/memory.pxd":91
4996
* cdef void* ret = sig_malloc(n)
4997
* if unlikely(ret == NULL):
4998
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
4999
* return ret
5000
*
5001
*/
5002
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 91, __pyx_L1_error)
5003
__Pyx_GOTREF(__pyx_t_2);
5004
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
5005
__Pyx_GOTREF(__pyx_t_3);
5006
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 91, __pyx_L1_error)
5007
__Pyx_GOTREF(__pyx_t_4);
5008
__Pyx_GIVEREF(__pyx_t_2);
5009
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
5010
__Pyx_GIVEREF(__pyx_t_3);
5011
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
5012
__pyx_t_2 = 0;
5013
__pyx_t_3 = 0;
5014
__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)
5015
__Pyx_GOTREF(__pyx_t_3);
5016
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5017
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 91, __pyx_L1_error)
5018
__Pyx_GOTREF(__pyx_t_4);
5019
__Pyx_GIVEREF(__pyx_t_3);
5020
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
5021
__pyx_t_3 = 0;
5022
__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)
5023
__Pyx_GOTREF(__pyx_t_3);
5024
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5025
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5026
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5027
__PYX_ERR(2, 91, __pyx_L1_error)
5028
5029
/* "cysignals/memory.pxd":90
5030
* cdef size_t n = mul_overflowcheck(nmemb, size)
5031
* cdef void* ret = sig_malloc(n)
5032
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5033
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5034
* return ret
5035
*/
5036
}
5037
5038
/* "cysignals/memory.pxd":92
5039
* if unlikely(ret == NULL):
5040
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5041
* return ret # <<<<<<<<<<<<<<
5042
*
5043
*
5044
*/
5045
__pyx_r = __pyx_v_ret;
5046
goto __pyx_L0;
5047
5048
/* "cysignals/memory.pxd":82
5049
*
5050
*
5051
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5052
* """
5053
* Allocate memory for ``nmemb`` elements of size ``size``.
5054
*/
5055
5056
/* function exit code */
5057
__pyx_L1_error:;
5058
__Pyx_XDECREF(__pyx_t_2);
5059
__Pyx_XDECREF(__pyx_t_3);
5060
__Pyx_XDECREF(__pyx_t_4);
5061
__Pyx_AddTraceback("cysignals.memory.check_allocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
5062
__pyx_r = NULL;
5063
__pyx_L0:;
5064
__Pyx_RefNannyFinishContext();
5065
return __pyx_r;
5066
}
5067
5068
/* "cysignals/memory.pxd":95
5069
*
5070
*
5071
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5072
* """
5073
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
5074
*/
5075
5076
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *__pyx_v_ptr, size_t __pyx_v_nmemb, size_t __pyx_v_size) {
5077
size_t __pyx_v_n;
5078
void *__pyx_v_ret;
5079
void *__pyx_r;
5080
__Pyx_RefNannyDeclarations
5081
int __pyx_t_1;
5082
PyObject *__pyx_t_2 = NULL;
5083
PyObject *__pyx_t_3 = NULL;
5084
PyObject *__pyx_t_4 = NULL;
5085
__Pyx_RefNannySetupContext("check_reallocarray", 0);
5086
5087
/* "cysignals/memory.pxd":103
5088
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
5089
* """
5090
* if nmemb == 0: # <<<<<<<<<<<<<<
5091
* sig_free(ptr)
5092
* return NULL
5093
*/
5094
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
5095
if (__pyx_t_1) {
5096
5097
/* "cysignals/memory.pxd":104
5098
* """
5099
* if nmemb == 0:
5100
* sig_free(ptr) # <<<<<<<<<<<<<<
5101
* return NULL
5102
* cdef size_t n = mul_overflowcheck(nmemb, size)
5103
*/
5104
sig_free(__pyx_v_ptr);
5105
5106
/* "cysignals/memory.pxd":105
5107
* if nmemb == 0:
5108
* sig_free(ptr)
5109
* return NULL # <<<<<<<<<<<<<<
5110
* cdef size_t n = mul_overflowcheck(nmemb, size)
5111
* cdef void* ret = sig_realloc(ptr, n)
5112
*/
5113
__pyx_r = NULL;
5114
goto __pyx_L0;
5115
5116
/* "cysignals/memory.pxd":103
5117
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
5118
* """
5119
* if nmemb == 0: # <<<<<<<<<<<<<<
5120
* sig_free(ptr)
5121
* return NULL
5122
*/
5123
}
5124
5125
/* "cysignals/memory.pxd":106
5126
* sig_free(ptr)
5127
* return NULL
5128
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
5129
* cdef void* ret = sig_realloc(ptr, n)
5130
* if unlikely(ret == NULL):
5131
*/
5132
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
5133
5134
/* "cysignals/memory.pxd":107
5135
* return NULL
5136
* cdef size_t n = mul_overflowcheck(nmemb, size)
5137
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
5138
* if unlikely(ret == NULL):
5139
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5140
*/
5141
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
5142
5143
/* "cysignals/memory.pxd":108
5144
* cdef size_t n = mul_overflowcheck(nmemb, size)
5145
* cdef void* ret = sig_realloc(ptr, n)
5146
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5147
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5148
* return ret
5149
*/
5150
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
5151
if (__pyx_t_1) {
5152
5153
/* "cysignals/memory.pxd":109
5154
* cdef void* ret = sig_realloc(ptr, n)
5155
* if unlikely(ret == NULL):
5156
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
5157
* return ret
5158
*
5159
*/
5160
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 109, __pyx_L1_error)
5161
__Pyx_GOTREF(__pyx_t_2);
5162
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 109, __pyx_L1_error)
5163
__Pyx_GOTREF(__pyx_t_3);
5164
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 109, __pyx_L1_error)
5165
__Pyx_GOTREF(__pyx_t_4);
5166
__Pyx_GIVEREF(__pyx_t_2);
5167
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
5168
__Pyx_GIVEREF(__pyx_t_3);
5169
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
5170
__pyx_t_2 = 0;
5171
__pyx_t_3 = 0;
5172
__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)
5173
__Pyx_GOTREF(__pyx_t_3);
5174
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5175
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 109, __pyx_L1_error)
5176
__Pyx_GOTREF(__pyx_t_4);
5177
__Pyx_GIVEREF(__pyx_t_3);
5178
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
5179
__pyx_t_3 = 0;
5180
__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)
5181
__Pyx_GOTREF(__pyx_t_3);
5182
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5183
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5184
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5185
__PYX_ERR(2, 109, __pyx_L1_error)
5186
5187
/* "cysignals/memory.pxd":108
5188
* cdef size_t n = mul_overflowcheck(nmemb, size)
5189
* cdef void* ret = sig_realloc(ptr, n)
5190
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5191
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5192
* return ret
5193
*/
5194
}
5195
5196
/* "cysignals/memory.pxd":110
5197
* if unlikely(ret == NULL):
5198
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5199
* return ret # <<<<<<<<<<<<<<
5200
*
5201
*
5202
*/
5203
__pyx_r = __pyx_v_ret;
5204
goto __pyx_L0;
5205
5206
/* "cysignals/memory.pxd":95
5207
*
5208
*
5209
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5210
* """
5211
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
5212
*/
5213
5214
/* function exit code */
5215
__pyx_L1_error:;
5216
__Pyx_XDECREF(__pyx_t_2);
5217
__Pyx_XDECREF(__pyx_t_3);
5218
__Pyx_XDECREF(__pyx_t_4);
5219
__Pyx_AddTraceback("cysignals.memory.check_reallocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
5220
__pyx_r = NULL;
5221
__pyx_L0:;
5222
__Pyx_RefNannyFinishContext();
5223
return __pyx_r;
5224
}
5225
5226
/* "cysignals/memory.pxd":113
5227
*
5228
*
5229
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
5230
* """
5231
* Allocate ``n`` bytes of memory.
5232
*/
5233
5234
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t __pyx_v_n) {
5235
void *__pyx_v_ret;
5236
void *__pyx_r;
5237
__Pyx_RefNannyDeclarations
5238
int __pyx_t_1;
5239
PyObject *__pyx_t_2 = NULL;
5240
PyObject *__pyx_t_3 = NULL;
5241
__Pyx_RefNannySetupContext("check_malloc", 0);
5242
5243
/* "cysignals/memory.pxd":117
5244
* Allocate ``n`` bytes of memory.
5245
* """
5246
* if n == 0: # <<<<<<<<<<<<<<
5247
* return NULL
5248
* cdef void* ret = sig_malloc(n)
5249
*/
5250
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
5251
if (__pyx_t_1) {
5252
5253
/* "cysignals/memory.pxd":118
5254
* """
5255
* if n == 0:
5256
* return NULL # <<<<<<<<<<<<<<
5257
* cdef void* ret = sig_malloc(n)
5258
* if unlikely(ret == NULL):
5259
*/
5260
__pyx_r = NULL;
5261
goto __pyx_L0;
5262
5263
/* "cysignals/memory.pxd":117
5264
* Allocate ``n`` bytes of memory.
5265
* """
5266
* if n == 0: # <<<<<<<<<<<<<<
5267
* return NULL
5268
* cdef void* ret = sig_malloc(n)
5269
*/
5270
}
5271
5272
/* "cysignals/memory.pxd":119
5273
* if n == 0:
5274
* return NULL
5275
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
5276
* if unlikely(ret == NULL):
5277
* raise MemoryError("failed to allocate %s bytes" % n)
5278
*/
5279
__pyx_v_ret = sig_malloc(__pyx_v_n);
5280
5281
/* "cysignals/memory.pxd":120
5282
* return NULL
5283
* cdef void* ret = sig_malloc(n)
5284
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5285
* raise MemoryError("failed to allocate %s bytes" % n)
5286
* return ret
5287
*/
5288
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
5289
if (__pyx_t_1) {
5290
5291
/* "cysignals/memory.pxd":121
5292
* cdef void* ret = sig_malloc(n)
5293
* if unlikely(ret == NULL):
5294
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
5295
* return ret
5296
*
5297
*/
5298
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 121, __pyx_L1_error)
5299
__Pyx_GOTREF(__pyx_t_2);
5300
__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)
5301
__Pyx_GOTREF(__pyx_t_3);
5302
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5303
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 121, __pyx_L1_error)
5304
__Pyx_GOTREF(__pyx_t_2);
5305
__Pyx_GIVEREF(__pyx_t_3);
5306
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
5307
__pyx_t_3 = 0;
5308
__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)
5309
__Pyx_GOTREF(__pyx_t_3);
5310
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5311
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5312
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5313
__PYX_ERR(2, 121, __pyx_L1_error)
5314
5315
/* "cysignals/memory.pxd":120
5316
* return NULL
5317
* cdef void* ret = sig_malloc(n)
5318
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5319
* raise MemoryError("failed to allocate %s bytes" % n)
5320
* return ret
5321
*/
5322
}
5323
5324
/* "cysignals/memory.pxd":122
5325
* if unlikely(ret == NULL):
5326
* raise MemoryError("failed to allocate %s bytes" % n)
5327
* return ret # <<<<<<<<<<<<<<
5328
*
5329
*
5330
*/
5331
__pyx_r = __pyx_v_ret;
5332
goto __pyx_L0;
5333
5334
/* "cysignals/memory.pxd":113
5335
*
5336
*
5337
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
5338
* """
5339
* Allocate ``n`` bytes of memory.
5340
*/
5341
5342
/* function exit code */
5343
__pyx_L1_error:;
5344
__Pyx_XDECREF(__pyx_t_2);
5345
__Pyx_XDECREF(__pyx_t_3);
5346
__Pyx_AddTraceback("cysignals.memory.check_malloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5347
__pyx_r = NULL;
5348
__pyx_L0:;
5349
__Pyx_RefNannyFinishContext();
5350
return __pyx_r;
5351
}
5352
5353
/* "cysignals/memory.pxd":125
5354
*
5355
*
5356
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
5357
* """
5358
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
5359
*/
5360
5361
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *__pyx_v_ptr, size_t __pyx_v_n) {
5362
void *__pyx_v_ret;
5363
void *__pyx_r;
5364
__Pyx_RefNannyDeclarations
5365
int __pyx_t_1;
5366
PyObject *__pyx_t_2 = NULL;
5367
PyObject *__pyx_t_3 = NULL;
5368
__Pyx_RefNannySetupContext("check_realloc", 0);
5369
5370
/* "cysignals/memory.pxd":130
5371
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
5372
* """
5373
* if n == 0: # <<<<<<<<<<<<<<
5374
* sig_free(ptr)
5375
* return NULL
5376
*/
5377
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
5378
if (__pyx_t_1) {
5379
5380
/* "cysignals/memory.pxd":131
5381
* """
5382
* if n == 0:
5383
* sig_free(ptr) # <<<<<<<<<<<<<<
5384
* return NULL
5385
* cdef void* ret = sig_realloc(ptr, n)
5386
*/
5387
sig_free(__pyx_v_ptr);
5388
5389
/* "cysignals/memory.pxd":132
5390
* if n == 0:
5391
* sig_free(ptr)
5392
* return NULL # <<<<<<<<<<<<<<
5393
* cdef void* ret = sig_realloc(ptr, n)
5394
* if unlikely(ret == NULL):
5395
*/
5396
__pyx_r = NULL;
5397
goto __pyx_L0;
5398
5399
/* "cysignals/memory.pxd":130
5400
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
5401
* """
5402
* if n == 0: # <<<<<<<<<<<<<<
5403
* sig_free(ptr)
5404
* return NULL
5405
*/
5406
}
5407
5408
/* "cysignals/memory.pxd":133
5409
* sig_free(ptr)
5410
* return NULL
5411
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
5412
* if unlikely(ret == NULL):
5413
* raise MemoryError("failed to allocate %s bytes" % n)
5414
*/
5415
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
5416
5417
/* "cysignals/memory.pxd":134
5418
* return NULL
5419
* cdef void* ret = sig_realloc(ptr, n)
5420
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5421
* raise MemoryError("failed to allocate %s bytes" % n)
5422
* return ret
5423
*/
5424
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
5425
if (__pyx_t_1) {
5426
5427
/* "cysignals/memory.pxd":135
5428
* cdef void* ret = sig_realloc(ptr, n)
5429
* if unlikely(ret == NULL):
5430
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
5431
* return ret
5432
*
5433
*/
5434
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
5435
__Pyx_GOTREF(__pyx_t_2);
5436
__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)
5437
__Pyx_GOTREF(__pyx_t_3);
5438
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5439
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
5440
__Pyx_GOTREF(__pyx_t_2);
5441
__Pyx_GIVEREF(__pyx_t_3);
5442
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
5443
__pyx_t_3 = 0;
5444
__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)
5445
__Pyx_GOTREF(__pyx_t_3);
5446
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5447
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5448
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5449
__PYX_ERR(2, 135, __pyx_L1_error)
5450
5451
/* "cysignals/memory.pxd":134
5452
* return NULL
5453
* cdef void* ret = sig_realloc(ptr, n)
5454
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5455
* raise MemoryError("failed to allocate %s bytes" % n)
5456
* return ret
5457
*/
5458
}
5459
5460
/* "cysignals/memory.pxd":136
5461
* if unlikely(ret == NULL):
5462
* raise MemoryError("failed to allocate %s bytes" % n)
5463
* return ret # <<<<<<<<<<<<<<
5464
*
5465
*
5466
*/
5467
__pyx_r = __pyx_v_ret;
5468
goto __pyx_L0;
5469
5470
/* "cysignals/memory.pxd":125
5471
*
5472
*
5473
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
5474
* """
5475
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
5476
*/
5477
5478
/* function exit code */
5479
__pyx_L1_error:;
5480
__Pyx_XDECREF(__pyx_t_2);
5481
__Pyx_XDECREF(__pyx_t_3);
5482
__Pyx_AddTraceback("cysignals.memory.check_realloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5483
__pyx_r = NULL;
5484
__pyx_L0:;
5485
__Pyx_RefNannyFinishContext();
5486
return __pyx_r;
5487
}
5488
5489
/* "cysignals/memory.pxd":139
5490
*
5491
*
5492
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5493
* """
5494
* Allocate memory for ``nmemb`` elements of size ``size``. The
5495
*/
5496
5497
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
5498
void *__pyx_v_ret;
5499
void *__pyx_r;
5500
__Pyx_RefNannyDeclarations
5501
int __pyx_t_1;
5502
PyObject *__pyx_t_2 = NULL;
5503
PyObject *__pyx_t_3 = NULL;
5504
PyObject *__pyx_t_4 = NULL;
5505
__Pyx_RefNannySetupContext("check_calloc", 0);
5506
5507
/* "cysignals/memory.pxd":144
5508
* resulting memory is zeroed.
5509
* """
5510
* if nmemb == 0: # <<<<<<<<<<<<<<
5511
* return NULL
5512
* cdef void* ret = sig_calloc(nmemb, size)
5513
*/
5514
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
5515
if (__pyx_t_1) {
5516
5517
/* "cysignals/memory.pxd":145
5518
* """
5519
* if nmemb == 0:
5520
* return NULL # <<<<<<<<<<<<<<
5521
* cdef void* ret = sig_calloc(nmemb, size)
5522
* if unlikely(ret == NULL):
5523
*/
5524
__pyx_r = NULL;
5525
goto __pyx_L0;
5526
5527
/* "cysignals/memory.pxd":144
5528
* resulting memory is zeroed.
5529
* """
5530
* if nmemb == 0: # <<<<<<<<<<<<<<
5531
* return NULL
5532
* cdef void* ret = sig_calloc(nmemb, size)
5533
*/
5534
}
5535
5536
/* "cysignals/memory.pxd":146
5537
* if nmemb == 0:
5538
* return NULL
5539
* cdef void* ret = sig_calloc(nmemb, size) # <<<<<<<<<<<<<<
5540
* if unlikely(ret == NULL):
5541
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5542
*/
5543
__pyx_v_ret = sig_calloc(__pyx_v_nmemb, __pyx_v_size);
5544
5545
/* "cysignals/memory.pxd":147
5546
* return NULL
5547
* cdef void* ret = sig_calloc(nmemb, size)
5548
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5549
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5550
* return ret
5551
*/
5552
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
5553
if (__pyx_t_1) {
5554
5555
/* "cysignals/memory.pxd":148
5556
* cdef void* ret = sig_calloc(nmemb, size)
5557
* if unlikely(ret == NULL):
5558
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
5559
* return ret
5560
*/
5561
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 148, __pyx_L1_error)
5562
__Pyx_GOTREF(__pyx_t_2);
5563
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
5564
__Pyx_GOTREF(__pyx_t_3);
5565
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 148, __pyx_L1_error)
5566
__Pyx_GOTREF(__pyx_t_4);
5567
__Pyx_GIVEREF(__pyx_t_2);
5568
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
5569
__Pyx_GIVEREF(__pyx_t_3);
5570
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
5571
__pyx_t_2 = 0;
5572
__pyx_t_3 = 0;
5573
__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)
5574
__Pyx_GOTREF(__pyx_t_3);
5575
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5576
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 148, __pyx_L1_error)
5577
__Pyx_GOTREF(__pyx_t_4);
5578
__Pyx_GIVEREF(__pyx_t_3);
5579
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
5580
__pyx_t_3 = 0;
5581
__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)
5582
__Pyx_GOTREF(__pyx_t_3);
5583
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5584
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
5585
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5586
__PYX_ERR(2, 148, __pyx_L1_error)
5587
5588
/* "cysignals/memory.pxd":147
5589
* return NULL
5590
* cdef void* ret = sig_calloc(nmemb, size)
5591
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
5592
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5593
* return ret
5594
*/
5595
}
5596
5597
/* "cysignals/memory.pxd":149
5598
* if unlikely(ret == NULL):
5599
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
5600
* return ret # <<<<<<<<<<<<<<
5601
*/
5602
__pyx_r = __pyx_v_ret;
5603
goto __pyx_L0;
5604
5605
/* "cysignals/memory.pxd":139
5606
*
5607
*
5608
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
5609
* """
5610
* Allocate memory for ``nmemb`` elements of size ``size``. The
5611
*/
5612
5613
/* function exit code */
5614
__pyx_L1_error:;
5615
__Pyx_XDECREF(__pyx_t_2);
5616
__Pyx_XDECREF(__pyx_t_3);
5617
__Pyx_XDECREF(__pyx_t_4);
5618
__Pyx_AddTraceback("cysignals.memory.check_calloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5619
__pyx_r = NULL;
5620
__pyx_L0:;
5621
__Pyx_RefNannyFinishContext();
5622
return __pyx_r;
5623
}
5624
5625
/* "parent.pxd":23
5626
* # Flags, see below
5627
* cdef int flags
5628
* cdef inline bint get_flag(self, int flag): # <<<<<<<<<<<<<<
5629
* return self.flags & flag
5630
*
5631
*/
5632
5633
static CYTHON_INLINE int __pyx_f_4sage_9structure_6parent_6Parent_get_flag(struct __pyx_obj_4sage_9structure_6parent_Parent *__pyx_v_self, int __pyx_v_flag) {
5634
int __pyx_r;
5635
__Pyx_RefNannyDeclarations
5636
__Pyx_RefNannySetupContext("get_flag", 0);
5637
5638
/* "parent.pxd":24
5639
* cdef int flags
5640
* cdef inline bint get_flag(self, int flag):
5641
* return self.flags & flag # <<<<<<<<<<<<<<
5642
*
5643
* cpdef bint is_coercion_cached(self, domain)
5644
*/
5645
__pyx_r = (__pyx_v_self->flags & __pyx_v_flag);
5646
goto __pyx_L0;
5647
5648
/* "parent.pxd":23
5649
* # Flags, see below
5650
* cdef int flags
5651
* cdef inline bint get_flag(self, int flag): # <<<<<<<<<<<<<<
5652
* return self.flags & flag
5653
*
5654
*/
5655
5656
/* function exit code */
5657
__pyx_L0:;
5658
__Pyx_RefNannyFinishContext();
5659
return __pyx_r;
5660
}
5661
5662
/* "sage_object.pxd":13
5663
*
5664
*
5665
* cpdef inline richcmp_not_equal(x, y, int op): # <<<<<<<<<<<<<<
5666
* """
5667
* Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.
5668
*/
5669
5670
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5671
static CYTHON_INLINE PyObject *__pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op, CYTHON_UNUSED int __pyx_skip_dispatch) {
5672
PyObject *__pyx_r = NULL;
5673
__Pyx_RefNannyDeclarations
5674
int __pyx_t_1;
5675
PyObject *__pyx_t_2 = NULL;
5676
__Pyx_RefNannySetupContext("richcmp_not_equal", 0);
5677
5678
/* "sage_object.pxd":70
5679
* True
5680
* """
5681
* if op == Py_EQ: # <<<<<<<<<<<<<<
5682
* return False
5683
* elif op == Py_NE:
5684
*/
5685
__pyx_t_1 = ((__pyx_v_op == Py_EQ) != 0);
5686
if (__pyx_t_1) {
5687
5688
/* "sage_object.pxd":71
5689
* """
5690
* if op == Py_EQ:
5691
* return False # <<<<<<<<<<<<<<
5692
* elif op == Py_NE:
5693
* return True
5694
*/
5695
__Pyx_XDECREF(__pyx_r);
5696
__Pyx_INCREF(Py_False);
5697
__pyx_r = Py_False;
5698
goto __pyx_L0;
5699
5700
/* "sage_object.pxd":70
5701
* True
5702
* """
5703
* if op == Py_EQ: # <<<<<<<<<<<<<<
5704
* return False
5705
* elif op == Py_NE:
5706
*/
5707
}
5708
5709
/* "sage_object.pxd":72
5710
* if op == Py_EQ:
5711
* return False
5712
* elif op == Py_NE: # <<<<<<<<<<<<<<
5713
* return True
5714
* return richcmp(x, y, op)
5715
*/
5716
__pyx_t_1 = ((__pyx_v_op == Py_NE) != 0);
5717
if (__pyx_t_1) {
5718
5719
/* "sage_object.pxd":73
5720
* return False
5721
* elif op == Py_NE:
5722
* return True # <<<<<<<<<<<<<<
5723
* return richcmp(x, y, op)
5724
*
5725
*/
5726
__Pyx_XDECREF(__pyx_r);
5727
__Pyx_INCREF(Py_True);
5728
__pyx_r = Py_True;
5729
goto __pyx_L0;
5730
5731
/* "sage_object.pxd":72
5732
* if op == Py_EQ:
5733
* return False
5734
* elif op == Py_NE: # <<<<<<<<<<<<<<
5735
* return True
5736
* return richcmp(x, y, op)
5737
*/
5738
}
5739
5740
/* "sage_object.pxd":74
5741
* elif op == Py_NE:
5742
* return True
5743
* return richcmp(x, y, op) # <<<<<<<<<<<<<<
5744
*
5745
*
5746
*/
5747
__Pyx_XDECREF(__pyx_r);
5748
__pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_v_y, __pyx_v_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 74, __pyx_L1_error)
5749
__Pyx_GOTREF(__pyx_t_2);
5750
__pyx_r = __pyx_t_2;
5751
__pyx_t_2 = 0;
5752
goto __pyx_L0;
5753
5754
/* "sage_object.pxd":13
5755
*
5756
*
5757
* cpdef inline richcmp_not_equal(x, y, int op): # <<<<<<<<<<<<<<
5758
* """
5759
* Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.
5760
*/
5761
5762
/* function exit code */
5763
__pyx_L1_error:;
5764
__Pyx_XDECREF(__pyx_t_2);
5765
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
5766
__pyx_r = 0;
5767
__pyx_L0:;
5768
__Pyx_XGIVEREF(__pyx_r);
5769
__Pyx_RefNannyFinishContext();
5770
return __pyx_r;
5771
}
5772
5773
/* Python wrapper */
5774
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5775
static char __pyx_doc_4sage_9structure_11sage_object_richcmp_not_equal[] = "File: (starting at line 13)\n\n Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`.\n\n INPUT:\n\n - ``op`` -- a rich comparison operation (e.g. ``Py_EQ``)\n\n OUTPUT:\n\n If ``op`` is not ``op_EQ`` or ``op_NE``, the result of\n ``richcmp(x, y, op)``. If ``op`` is ``op_EQ``, return\n ``False``. If ``op`` is ``op_NE``, return ``True``.\n\n This is useful to compare lazily two objects A and B according to 2\n (or more) different parameters, say width and height for example.\n One could use::\n\n return richcmp((A.width(), A.height()), (B.width(), B.height()), op)\n\n but this will compute both width and height in all cases, even if\n A.width() and B.width() are enough to decide the comparison.\n\n Instead one can do::\n\n wA = A.width()\n wB = B.width()\n if wA != wB:\n return richcmp_not_equal(wA, wB, op)\n return richcmp(A.height(), B.height(), op)\n\n The difference with ``richcmp`` is that ``richcmp_not_equal``\n assumes that its arguments are not equal, which is excluding the case\n where the comparison cannot be decided so far, without\n knowing the rest of the parameters.\n\n EXAMPLES::\n\n sage: from sage.structure.sage_object import (richcmp_not_equal,\n ....: op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE)\n sage: for op in (op_LT, op_LE, op_EQ, op_NE, op_GT, op_GE):\n ....: print(richcmp_not_equal(3, 4, op))\n True\n True\n False\n True\n False\n False\n sage: for op in (op_LT, op_LE, op_EQ, op_NE, op_GT, op_GE):\n ....: print(richcmp_not_equal(5, 4, op))\n False\n False\n False\n True\n True\n True\n ";
5776
static PyObject *__pyx_pw_4sage_9structure_11sage_object_1richcmp_not_equal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5777
PyObject *__pyx_v_x = 0;
5778
PyObject *__pyx_v_y = 0;
5779
int __pyx_v_op;
5780
PyObject *__pyx_r = 0;
5781
__Pyx_RefNannyDeclarations
5782
__Pyx_RefNannySetupContext("richcmp_not_equal (wrapper)", 0);
5783
{
5784
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_op,0};
5785
PyObject* values[3] = {0,0,0};
5786
if (unlikely(__pyx_kwds)) {
5787
Py_ssize_t kw_args;
5788
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5789
switch (pos_args) {
5790
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5791
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5792
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5793
case 0: break;
5794
default: goto __pyx_L5_argtuple_error;
5795
}
5796
kw_args = PyDict_Size(__pyx_kwds);
5797
switch (pos_args) {
5798
case 0:
5799
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5800
else goto __pyx_L5_argtuple_error;
5801
case 1:
5802
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
5803
else {
5804
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, 1); __PYX_ERR(3, 13, __pyx_L3_error)
5805
}
5806
case 2:
5807
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
5808
else {
5809
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, 2); __PYX_ERR(3, 13, __pyx_L3_error)
5810
}
5811
}
5812
if (unlikely(kw_args > 0)) {
5813
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "richcmp_not_equal") < 0)) __PYX_ERR(3, 13, __pyx_L3_error)
5814
}
5815
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5816
goto __pyx_L5_argtuple_error;
5817
} else {
5818
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5819
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5820
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5821
}
5822
__pyx_v_x = values[0];
5823
__pyx_v_y = values[1];
5824
__pyx_v_op = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 13, __pyx_L3_error)
5825
}
5826
goto __pyx_L4_argument_unpacking_done;
5827
__pyx_L5_argtuple_error:;
5828
__Pyx_RaiseArgtupleInvalid("richcmp_not_equal", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 13, __pyx_L3_error)
5829
__pyx_L3_error:;
5830
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
5831
__Pyx_RefNannyFinishContext();
5832
return NULL;
5833
__pyx_L4_argument_unpacking_done:;
5834
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_op);
5835
5836
/* function exit code */
5837
__Pyx_RefNannyFinishContext();
5838
return __pyx_r;
5839
}
5840
5841
static PyObject *__pyx_pf_4sage_9structure_11sage_object_richcmp_not_equal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
5842
PyObject *__pyx_r = NULL;
5843
__Pyx_RefNannyDeclarations
5844
PyObject *__pyx_t_1 = NULL;
5845
__Pyx_RefNannySetupContext("richcmp_not_equal", 0);
5846
__Pyx_XDECREF(__pyx_r);
5847
__pyx_t_1 = __pyx_f_4sage_9structure_11sage_object_richcmp_not_equal(__pyx_v_x, __pyx_v_y, __pyx_v_op, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 13, __pyx_L1_error)
5848
__Pyx_GOTREF(__pyx_t_1);
5849
__pyx_r = __pyx_t_1;
5850
__pyx_t_1 = 0;
5851
goto __pyx_L0;
5852
5853
/* function exit code */
5854
__pyx_L1_error:;
5855
__Pyx_XDECREF(__pyx_t_1);
5856
__Pyx_AddTraceback("sage.structure.sage_object.richcmp_not_equal", __pyx_clineno, __pyx_lineno, __pyx_filename);
5857
__pyx_r = NULL;
5858
__pyx_L0:;
5859
__Pyx_XGIVEREF(__pyx_r);
5860
__Pyx_RefNannyFinishContext();
5861
return __pyx_r;
5862
}
5863
5864
/* "sage_object.pxd":77
5865
*
5866
*
5867
* cpdef inline bint rich_to_bool(int op, int c): # <<<<<<<<<<<<<<
5868
* """
5869
* Return the corresponding ``True`` or ``False`` value for a rich
5870
*/
5871
5872
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5873
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool(int __pyx_v_op, int __pyx_v_c, CYTHON_UNUSED int __pyx_skip_dispatch) {
5874
uint32_t __pyx_v_less_bits;
5875
uint32_t __pyx_v_equal_bits;
5876
uint32_t __pyx_v_greater_bits;
5877
uint32_t __pyx_v_bits;
5878
int __pyx_v_shift;
5879
int __pyx_r;
5880
__Pyx_RefNannyDeclarations
5881
__Pyx_RefNannySetupContext("rich_to_bool", 0);
5882
5883
/* "sage_object.pxd":139
5884
* # The 4 lines below involve just constants, so the compiler should
5885
* # optimize them to just one constant value for "bits".
5886
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE) # <<<<<<<<<<<<<<
5887
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
5888
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
5889
*/
5890
__pyx_v_less_bits = (((1 << Py_LT) + (1 << Py_LE)) + (1 << Py_NE));
5891
5892
/* "sage_object.pxd":140
5893
* # optimize them to just one constant value for "bits".
5894
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE)
5895
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ) # <<<<<<<<<<<<<<
5896
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
5897
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
5898
*/
5899
__pyx_v_equal_bits = (((1 << Py_LE) + (1 << Py_GE)) + (1 << Py_EQ));
5900
5901
/* "sage_object.pxd":141
5902
* cdef uint32_t less_bits = (1 << Py_LT) + (1 << Py_LE) + (1 << Py_NE)
5903
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
5904
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE) # <<<<<<<<<<<<<<
5905
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
5906
*
5907
*/
5908
__pyx_v_greater_bits = (((1 << Py_GT) + (1 << Py_GE)) + (1 << Py_NE));
5909
5910
/* "sage_object.pxd":142
5911
* cdef uint32_t equal_bits = (1 << Py_LE) + (1 << Py_GE) + (1 << Py_EQ)
5912
* cdef uint32_t greater_bits = (1 << Py_GT) + (1 << Py_GE) + (1 << Py_NE)
5913
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8) # <<<<<<<<<<<<<<
5914
*
5915
* cdef int shift = 8*c + op
5916
*/
5917
__pyx_v_bits = (((__pyx_v_less_bits << 24) + __pyx_v_equal_bits) + (__pyx_v_greater_bits << 8));
5918
5919
/* "sage_object.pxd":144
5920
* cdef uint32_t bits = (less_bits << 24) + (equal_bits) + (greater_bits << 8)
5921
*
5922
* cdef int shift = 8*c + op # <<<<<<<<<<<<<<
5923
*
5924
* # The shift masking (shift & 31) will likely be optimized away by
5925
*/
5926
__pyx_v_shift = ((8 * __pyx_v_c) + __pyx_v_op);
5927
5928
/* "sage_object.pxd":149
5929
* # the compiler since shift and bit test instructions implicitly
5930
* # mask their offset.
5931
* return (bits >> (shift & 31)) & 1 # <<<<<<<<<<<<<<
5932
*
5933
*
5934
*/
5935
__pyx_r = ((__pyx_v_bits >> (__pyx_v_shift & 31)) & 1);
5936
goto __pyx_L0;
5937
5938
/* "sage_object.pxd":77
5939
*
5940
*
5941
* cpdef inline bint rich_to_bool(int op, int c): # <<<<<<<<<<<<<<
5942
* """
5943
* Return the corresponding ``True`` or ``False`` value for a rich
5944
*/
5945
5946
/* function exit code */
5947
__pyx_L0:;
5948
__Pyx_RefNannyFinishContext();
5949
return __pyx_r;
5950
}
5951
5952
/* Python wrapper */
5953
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5954
static char __pyx_doc_4sage_9structure_11sage_object_2rich_to_bool[] = "File: (starting at line 77)\n\n Return the corresponding ``True`` or ``False`` value for a rich\n comparison, given the result of an ordinary comparison.\n\n INPUT:\n\n - ``op`` -- a rich comparison operation (e.g. ``Py_EQ``)\n\n - ``c`` -- the result of an ordinary comparison: -1, 0 or 1.\n\n OUTPUT: 1 or 0 (corresponding to ``True`` and ``False``)\n\n .. SEEALSO::\n\n ``rich_to_bool_sgn`` if ``c`` could be outside the [-1, 1]\n range.\n\n EXAMPLES::\n\n sage: from sage.structure.sage_object import (rich_to_bool,\n ....: op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE)\n sage: for op in (op_LT, op_LE, op_EQ, op_NE, op_GT, op_GE):\n ....: for c in (-1,0,1):\n ....: print(rich_to_bool(op, c))\n True False False\n True True False\n False True False\n True False True\n False False True\n False True True\n\n Indirect tests using integers::\n\n sage: 0 < 5, 5 < 5, 5 < -8\n (True, False, False)\n sage: 0 <= 5, 5 <= 5, 5 <= -8\n (True, True, False)\n sage: 0 >= 5, 5 >= 5, 5 >= -8\n (False, True, True)\n sage: 0 > 5, 5 > 5, 5 > -8\n (False, False, True)\n sage: 0 == 5, 5 == 5, 5 == -8\n (False, True, False)\n sage: 0 != 5, 5 != 5, 5 != -8\n (True, False, True)\n\n TESTS::\n\n sage: from sage.structure.sage_object import py_rich_to_bool\n sage: py_rich_to_bool(op_EQ, 0)\n doctest:...: DeprecationWarning: py_rich_to_bool is deprecated. Please use sage.structure.sage_object.rich_to_bool instead.\n See http://trac.sagemath.org/21128 for details.\n True\n ";
5955
static PyObject *__pyx_pw_4sage_9structure_11sage_object_3rich_to_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5956
int __pyx_v_op;
5957
int __pyx_v_c;
5958
PyObject *__pyx_r = 0;
5959
__Pyx_RefNannyDeclarations
5960
__Pyx_RefNannySetupContext("rich_to_bool (wrapper)", 0);
5961
{
5962
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_op,&__pyx_n_s_c,0};
5963
PyObject* values[2] = {0,0};
5964
if (unlikely(__pyx_kwds)) {
5965
Py_ssize_t kw_args;
5966
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5967
switch (pos_args) {
5968
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5969
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5970
case 0: break;
5971
default: goto __pyx_L5_argtuple_error;
5972
}
5973
kw_args = PyDict_Size(__pyx_kwds);
5974
switch (pos_args) {
5975
case 0:
5976
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
5977
else goto __pyx_L5_argtuple_error;
5978
case 1:
5979
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
5980
else {
5981
__Pyx_RaiseArgtupleInvalid("rich_to_bool", 1, 2, 2, 1); __PYX_ERR(3, 77, __pyx_L3_error)
5982
}
5983
}
5984
if (unlikely(kw_args > 0)) {
5985
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rich_to_bool") < 0)) __PYX_ERR(3, 77, __pyx_L3_error)
5986
}
5987
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5988
goto __pyx_L5_argtuple_error;
5989
} else {
5990
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5991
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5992
}
5993
__pyx_v_op = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 77, __pyx_L3_error)
5994
__pyx_v_c = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 77, __pyx_L3_error)
5995
}
5996
goto __pyx_L4_argument_unpacking_done;
5997
__pyx_L5_argtuple_error:;
5998
__Pyx_RaiseArgtupleInvalid("rich_to_bool", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 77, __pyx_L3_error)
5999
__pyx_L3_error:;
6000
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
6001
__Pyx_RefNannyFinishContext();
6002
return NULL;
6003
__pyx_L4_argument_unpacking_done:;
6004
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(__pyx_self, __pyx_v_op, __pyx_v_c);
6005
6006
/* function exit code */
6007
__Pyx_RefNannyFinishContext();
6008
return __pyx_r;
6009
}
6010
6011
static PyObject *__pyx_pf_4sage_9structure_11sage_object_2rich_to_bool(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c) {
6012
PyObject *__pyx_r = NULL;
6013
__Pyx_RefNannyDeclarations
6014
PyObject *__pyx_t_1 = NULL;
6015
__Pyx_RefNannySetupContext("rich_to_bool", 0);
6016
__Pyx_XDECREF(__pyx_r);
6017
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_11sage_object_rich_to_bool(__pyx_v_op, __pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 77, __pyx_L1_error)
6018
__Pyx_GOTREF(__pyx_t_1);
6019
__pyx_r = __pyx_t_1;
6020
__pyx_t_1 = 0;
6021
goto __pyx_L0;
6022
6023
/* function exit code */
6024
__pyx_L1_error:;
6025
__Pyx_XDECREF(__pyx_t_1);
6026
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
6027
__pyx_r = NULL;
6028
__pyx_L0:;
6029
__Pyx_XGIVEREF(__pyx_r);
6030
__Pyx_RefNannyFinishContext();
6031
return __pyx_r;
6032
}
6033
6034
/* "sage_object.pxd":152
6035
*
6036
*
6037
* cpdef inline bint rich_to_bool_sgn(int op, int c): # <<<<<<<<<<<<<<
6038
* """
6039
* Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`
6040
*/
6041
6042
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6043
static CYTHON_INLINE int __pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(int __pyx_v_op, int __pyx_v_c, CYTHON_UNUSED int __pyx_skip_dispatch) {
6044
int __pyx_r;
6045
__Pyx_RefNannyDeclarations
6046
__Pyx_RefNannySetupContext("rich_to_bool_sgn", 0);
6047
6048
/* "sage_object.pxd":161
6049
* This is in particular needed for ``mpz_cmp()``.
6050
* """
6051
* return rich_to_bool(op, (c > 0) - (c < 0)) # <<<<<<<<<<<<<<
6052
*/
6053
__pyx_r = __pyx_f_4sage_9structure_11sage_object_rich_to_bool(__pyx_v_op, ((__pyx_v_c > 0) - (__pyx_v_c < 0)), 0);
6054
goto __pyx_L0;
6055
6056
/* "sage_object.pxd":152
6057
*
6058
*
6059
* cpdef inline bint rich_to_bool_sgn(int op, int c): # <<<<<<<<<<<<<<
6060
* """
6061
* Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`
6062
*/
6063
6064
/* function exit code */
6065
__pyx_L0:;
6066
__Pyx_RefNannyFinishContext();
6067
return __pyx_r;
6068
}
6069
6070
/* Python wrapper */
6071
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6072
static char __pyx_doc_4sage_9structure_11sage_object_4rich_to_bool_sgn[] = "File: (starting at line 152)\n\n Same as ``rich_to_bool``, but allow any `c < 0` and `c > 0`\n instead of only `-1` and `1`.\n\n .. NOTE::\n\n This is in particular needed for ``mpz_cmp()``.\n ";
6073
static PyObject *__pyx_pw_4sage_9structure_11sage_object_5rich_to_bool_sgn(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6074
int __pyx_v_op;
6075
int __pyx_v_c;
6076
PyObject *__pyx_r = 0;
6077
__Pyx_RefNannyDeclarations
6078
__Pyx_RefNannySetupContext("rich_to_bool_sgn (wrapper)", 0);
6079
{
6080
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_op,&__pyx_n_s_c,0};
6081
PyObject* values[2] = {0,0};
6082
if (unlikely(__pyx_kwds)) {
6083
Py_ssize_t kw_args;
6084
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6085
switch (pos_args) {
6086
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6087
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6088
case 0: break;
6089
default: goto __pyx_L5_argtuple_error;
6090
}
6091
kw_args = PyDict_Size(__pyx_kwds);
6092
switch (pos_args) {
6093
case 0:
6094
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_op)) != 0)) kw_args--;
6095
else goto __pyx_L5_argtuple_error;
6096
case 1:
6097
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
6098
else {
6099
__Pyx_RaiseArgtupleInvalid("rich_to_bool_sgn", 1, 2, 2, 1); __PYX_ERR(3, 152, __pyx_L3_error)
6100
}
6101
}
6102
if (unlikely(kw_args > 0)) {
6103
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rich_to_bool_sgn") < 0)) __PYX_ERR(3, 152, __pyx_L3_error)
6104
}
6105
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6106
goto __pyx_L5_argtuple_error;
6107
} else {
6108
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6109
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6110
}
6111
__pyx_v_op = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_op == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 152, __pyx_L3_error)
6112
__pyx_v_c = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 152, __pyx_L3_error)
6113
}
6114
goto __pyx_L4_argument_unpacking_done;
6115
__pyx_L5_argtuple_error:;
6116
__Pyx_RaiseArgtupleInvalid("rich_to_bool_sgn", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 152, __pyx_L3_error)
6117
__pyx_L3_error:;
6118
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool_sgn", __pyx_clineno, __pyx_lineno, __pyx_filename);
6119
__Pyx_RefNannyFinishContext();
6120
return NULL;
6121
__pyx_L4_argument_unpacking_done:;
6122
__pyx_r = __pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(__pyx_self, __pyx_v_op, __pyx_v_c);
6123
6124
/* function exit code */
6125
__Pyx_RefNannyFinishContext();
6126
return __pyx_r;
6127
}
6128
6129
static PyObject *__pyx_pf_4sage_9structure_11sage_object_4rich_to_bool_sgn(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_op, int __pyx_v_c) {
6130
PyObject *__pyx_r = NULL;
6131
__Pyx_RefNannyDeclarations
6132
PyObject *__pyx_t_1 = NULL;
6133
__Pyx_RefNannySetupContext("rich_to_bool_sgn", 0);
6134
__Pyx_XDECREF(__pyx_r);
6135
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_4sage_9structure_11sage_object_rich_to_bool_sgn(__pyx_v_op, __pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 152, __pyx_L1_error)
6136
__Pyx_GOTREF(__pyx_t_1);
6137
__pyx_r = __pyx_t_1;
6138
__pyx_t_1 = 0;
6139
goto __pyx_L0;
6140
6141
/* function exit code */
6142
__pyx_L1_error:;
6143
__Pyx_XDECREF(__pyx_t_1);
6144
__Pyx_AddTraceback("sage.structure.sage_object.rich_to_bool_sgn", __pyx_clineno, __pyx_lineno, __pyx_filename);
6145
__pyx_r = NULL;
6146
__pyx_L0:;
6147
__Pyx_XGIVEREF(__pyx_r);
6148
__Pyx_RefNannyFinishContext();
6149
return __pyx_r;
6150
}
6151
6152
/* "sage/ext/stdsage.pxd":16
6153
*
6154
*
6155
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
6156
* """
6157
* Return ``t.__new__(t)``. This works even for types like
6158
*/
6159
6160
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *__pyx_v_t) {
6161
PyObject *__pyx_r = NULL;
6162
__Pyx_RefNannyDeclarations
6163
PyObject *__pyx_t_1 = NULL;
6164
__Pyx_RefNannySetupContext("PY_NEW", 0);
6165
6166
/* "sage/ext/stdsage.pxd":22
6167
* optimizations assume that ``tp_new`` doesn't change).
6168
* """
6169
* return (<PyTypeObject*>t).tp_new(t, <object>NULL, <object>NULL) # <<<<<<<<<<<<<<
6170
*
6171
*
6172
*/
6173
__Pyx_XDECREF(__pyx_r);
6174
__pyx_t_1 = ((PyTypeObject *)__pyx_v_t)->tp_new(((PyTypeObject *)__pyx_v_t), ((PyObject *)NULL), ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22, __pyx_L1_error)
6175
__Pyx_GOTREF(__pyx_t_1);
6176
__pyx_r = __pyx_t_1;
6177
__pyx_t_1 = 0;
6178
goto __pyx_L0;
6179
6180
/* "sage/ext/stdsage.pxd":16
6181
*
6182
*
6183
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
6184
* """
6185
* Return ``t.__new__(t)``. This works even for types like
6186
*/
6187
6188
/* function exit code */
6189
__pyx_L1_error:;
6190
__Pyx_XDECREF(__pyx_t_1);
6191
__Pyx_AddTraceback("sage.ext.stdsage.PY_NEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
6192
__pyx_r = 0;
6193
__pyx_L0:;
6194
__Pyx_XGIVEREF(__pyx_r);
6195
__Pyx_RefNannyFinishContext();
6196
return __pyx_r;
6197
}
6198
6199
/* "sage/ext/stdsage.pxd":25
6200
*
6201
*
6202
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
6203
* """
6204
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
6205
*/
6206
6207
static CYTHON_INLINE void __pyx_f_4sage_3ext_7stdsage_PY_SET_TP_NEW(PyTypeObject *__pyx_v_dst, PyTypeObject *__pyx_v_src) {
6208
__Pyx_RefNannyDeclarations
6209
newfunc __pyx_t_1;
6210
__Pyx_RefNannySetupContext("PY_SET_TP_NEW", 0);
6211
6212
/* "sage/ext/stdsage.pxd":31
6213
* irrelevant base class ``tp_new`` methods.
6214
* """
6215
* (<PyTypeObject*>dst).tp_new = (<PyTypeObject*>src).tp_new # <<<<<<<<<<<<<<
6216
*
6217
*
6218
*/
6219
__pyx_t_1 = ((PyTypeObject *)__pyx_v_src)->tp_new;
6220
((PyTypeObject *)__pyx_v_dst)->tp_new = __pyx_t_1;
6221
6222
/* "sage/ext/stdsage.pxd":25
6223
*
6224
*
6225
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
6226
* """
6227
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
6228
*/
6229
6230
/* function exit code */
6231
__Pyx_RefNannyFinishContext();
6232
}
6233
6234
/* "sage/ext/stdsage.pxd":34
6235
*
6236
*
6237
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
6238
* """
6239
* Test whether the given object has a Python dictionary.
6240
*/
6241
6242
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *__pyx_v_obj) {
6243
int __pyx_r;
6244
__Pyx_RefNannyDeclarations
6245
__Pyx_RefNannySetupContext("HAS_DICTIONARY", 0);
6246
6247
/* "sage/ext/stdsage.pxd":38
6248
* Test whether the given object has a Python dictionary.
6249
* """
6250
* return Py_TYPE(obj).tp_dictoffset != 0 # <<<<<<<<<<<<<<
6251
*/
6252
__pyx_r = (Py_TYPE(__pyx_v_obj)->tp_dictoffset != 0);
6253
goto __pyx_L0;
6254
6255
/* "sage/ext/stdsage.pxd":34
6256
*
6257
*
6258
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
6259
* """
6260
* Test whether the given object has a Python dictionary.
6261
*/
6262
6263
/* function exit code */
6264
__pyx_L0:;
6265
__Pyx_RefNannyFinishContext();
6266
return __pyx_r;
6267
}
6268
6269
/* "cysignals/signals.pxd":35
6270
* # (PyErr_Occurred() is non-NULL). To Cython, it will look like
6271
* # cython_check_exception() actually raised the exception.
6272
* cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<<
6273
* pass
6274
*
6275
*/
6276
6277
static CYTHON_INLINE void __pyx_f_9cysignals_7signals_cython_check_exception(void) {
6278
6279
/* function exit code */
6280
}
6281
6282
/* "cfunc.to_py":65
6283
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
6284
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
6285
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
6286
* """wrap(arg0, arg1, arg2: 'int')"""
6287
* return f(arg0, arg1, arg2)
6288
*/
6289
6290
/* Python wrapper */
6291
static PyObject *__pyx_pw_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6292
static char __pyx_doc_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap[] = "File: (starting at line 65)\nwrap(arg0, arg1, arg2: 'int')";
6293
static PyMethodDef __pyx_mdef_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap = {"wrap", (PyCFunction)__pyx_pw_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap};
6294
static PyObject *__pyx_pw_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6295
PyObject *__pyx_v_arg0 = 0;
6296
PyObject *__pyx_v_arg1 = 0;
6297
int __pyx_v_arg2;
6298
PyObject *__pyx_r = 0;
6299
__Pyx_RefNannyDeclarations
6300
__Pyx_RefNannySetupContext("wrap (wrapper)", 0);
6301
{
6302
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg0,&__pyx_n_s_arg1,&__pyx_n_s_arg2,0};
6303
PyObject* values[3] = {0,0,0};
6304
if (unlikely(__pyx_kwds)) {
6305
Py_ssize_t kw_args;
6306
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6307
switch (pos_args) {
6308
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6309
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6310
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6311
case 0: break;
6312
default: goto __pyx_L5_argtuple_error;
6313
}
6314
kw_args = PyDict_Size(__pyx_kwds);
6315
switch (pos_args) {
6316
case 0:
6317
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg0)) != 0)) kw_args--;
6318
else goto __pyx_L5_argtuple_error;
6319
case 1:
6320
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg1)) != 0)) kw_args--;
6321
else {
6322
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, 1); __PYX_ERR(5, 65, __pyx_L3_error)
6323
}
6324
case 2:
6325
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_arg2)) != 0)) kw_args--;
6326
else {
6327
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, 2); __PYX_ERR(5, 65, __pyx_L3_error)
6328
}
6329
}
6330
if (unlikely(kw_args > 0)) {
6331
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wrap") < 0)) __PYX_ERR(5, 65, __pyx_L3_error)
6332
}
6333
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6334
goto __pyx_L5_argtuple_error;
6335
} else {
6336
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6337
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6338
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6339
}
6340
__pyx_v_arg0 = values[0];
6341
__pyx_v_arg1 = values[1];
6342
__pyx_v_arg2 = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_arg2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 65, __pyx_L3_error)
6343
}
6344
goto __pyx_L4_argument_unpacking_done;
6345
__pyx_L5_argtuple_error:;
6346
__Pyx_RaiseArgtupleInvalid("wrap", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 65, __pyx_L3_error)
6347
__pyx_L3_error:;
6348
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
6349
__Pyx_RefNannyFinishContext();
6350
return NULL;
6351
__pyx_L4_argument_unpacking_done:;
6352
__pyx_r = __pyx_pf_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap(__pyx_self, __pyx_v_arg0, __pyx_v_arg1, __pyx_v_arg2);
6353
6354
/* function exit code */
6355
__Pyx_RefNannyFinishContext();
6356
return __pyx_r;
6357
}
6358
6359
static PyObject *__pyx_pf_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_wrap(PyObject *__pyx_self, PyObject *__pyx_v_arg0, PyObject *__pyx_v_arg1, int __pyx_v_arg2) {
6360
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_cur_scope;
6361
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_outer_scope;
6362
PyObject *__pyx_r = NULL;
6363
__Pyx_RefNannyDeclarations
6364
PyObject *__pyx_t_1 = NULL;
6365
__Pyx_RefNannySetupContext("wrap", 0);
6366
__pyx_outer_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *) __Pyx_CyFunction_GetClosure(__pyx_self);
6367
__pyx_cur_scope = __pyx_outer_scope;
6368
6369
/* "cfunc.to_py":67
6370
* def wrap(object arg0, object arg1, int arg2):
6371
* """wrap(arg0, arg1, arg2: 'int')"""
6372
* return f(arg0, arg1, arg2) # <<<<<<<<<<<<<<
6373
* return wrap
6374
*
6375
*/
6376
__Pyx_XDECREF(__pyx_r);
6377
__pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_arg0, __pyx_v_arg1, __pyx_v_arg2); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 67, __pyx_L1_error)
6378
__Pyx_GOTREF(__pyx_t_1);
6379
__pyx_r = __pyx_t_1;
6380
__pyx_t_1 = 0;
6381
goto __pyx_L0;
6382
6383
/* "cfunc.to_py":65
6384
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
6385
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
6386
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
6387
* """wrap(arg0, arg1, arg2: 'int')"""
6388
* return f(arg0, arg1, arg2)
6389
*/
6390
6391
/* function exit code */
6392
__pyx_L1_error:;
6393
__Pyx_XDECREF(__pyx_t_1);
6394
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py.wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
6395
__pyx_r = NULL;
6396
__pyx_L0:;
6397
__Pyx_XGIVEREF(__pyx_r);
6398
__Pyx_RefNannyFinishContext();
6399
return __pyx_r;
6400
}
6401
6402
/* "cfunc.to_py":64
6403
*
6404
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
6405
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
6406
* def wrap(object arg0, object arg1, int arg2):
6407
* """wrap(arg0, arg1, arg2: 'int')"""
6408
*/
6409
6410
static PyObject *__Pyx_CFunc_object____object____object____int___to_py(PyObject *(*__pyx_v_f)(PyObject *, PyObject *, int)) {
6411
struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_cur_scope;
6412
PyObject *__pyx_v_wrap = 0;
6413
PyObject *__pyx_r = NULL;
6414
__Pyx_RefNannyDeclarations
6415
PyObject *__pyx_t_1 = NULL;
6416
__Pyx_RefNannySetupContext("__Pyx_CFunc_object____object____object____int___to_py", 0);
6417
__pyx_cur_scope = (struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, __pyx_empty_tuple, NULL);
6418
if (unlikely(!__pyx_cur_scope)) {
6419
__pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)Py_None);
6420
__Pyx_INCREF(Py_None);
6421
__PYX_ERR(5, 64, __pyx_L1_error)
6422
} else {
6423
__Pyx_GOTREF(__pyx_cur_scope);
6424
}
6425
__pyx_cur_scope->__pyx_v_f = __pyx_v_f;
6426
6427
/* "cfunc.to_py":65
6428
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
6429
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
6430
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
6431
* """wrap(arg0, arg1, arg2: 'int')"""
6432
* return f(arg0, arg1, arg2)
6433
*/
6434
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11cfunc_dot_to_py_53__Pyx_CFunc_object____object____object____int___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_object____object, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 65, __pyx_L1_error)
6435
__Pyx_GOTREF(__pyx_t_1);
6436
__pyx_v_wrap = __pyx_t_1;
6437
__pyx_t_1 = 0;
6438
6439
/* "cfunc.to_py":68
6440
* """wrap(arg0, arg1, arg2: 'int')"""
6441
* return f(arg0, arg1, arg2)
6442
* return wrap # <<<<<<<<<<<<<<
6443
*
6444
*
6445
*/
6446
__Pyx_XDECREF(__pyx_r);
6447
__Pyx_INCREF(__pyx_v_wrap);
6448
__pyx_r = __pyx_v_wrap;
6449
goto __pyx_L0;
6450
6451
/* "cfunc.to_py":64
6452
*
6453
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
6454
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
6455
* def wrap(object arg0, object arg1, int arg2):
6456
* """wrap(arg0, arg1, arg2: 'int')"""
6457
*/
6458
6459
/* function exit code */
6460
__pyx_L1_error:;
6461
__Pyx_XDECREF(__pyx_t_1);
6462
__Pyx_AddTraceback("cfunc.to_py.__Pyx_CFunc_object____object____object____int___to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
6463
__pyx_r = 0;
6464
__pyx_L0:;
6465
__Pyx_XDECREF(__pyx_v_wrap);
6466
__Pyx_DECREF(((PyObject *)__pyx_cur_scope));
6467
__Pyx_XGIVEREF(__pyx_r);
6468
__Pyx_RefNannyFinishContext();
6469
return __pyx_r;
6470
}
6471
6472
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
6473
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *p;
6474
PyObject *o;
6475
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
6476
o = (*t->tp_alloc)(t, 0);
6477
} else {
6478
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
6479
}
6480
if (unlikely(!o)) return 0;
6481
p = ((struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)o);
6482
p->primes = Py_None; Py_INCREF(Py_None);
6483
return o;
6484
}
6485
6486
static void __pyx_tp_dealloc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep(PyObject *o) {
6487
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)o;
6488
#if PY_VERSION_HEX >= 0x030400a1
6489
if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
6490
if (PyObject_CallFinalizerFromDealloc(o)) return;
6491
}
6492
#endif
6493
PyObject_GC_UnTrack(o);
6494
Py_CLEAR(p->primes);
6495
(*Py_TYPE(o)->tp_free)(o);
6496
}
6497
6498
static int __pyx_tp_traverse_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep(PyObject *o, visitproc v, void *a) {
6499
int e;
6500
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)o;
6501
if (p->primes) {
6502
e = (*v)(p->primes, a); if (e) return e;
6503
}
6504
return 0;
6505
}
6506
6507
static int __pyx_tp_clear_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep(PyObject *o) {
6508
PyObject* tmp;
6509
struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *p = (struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep *)o;
6510
tmp = ((PyObject*)p->primes);
6511
p->primes = Py_None; Py_INCREF(Py_None);
6512
Py_XDECREF(tmp);
6513
return 0;
6514
}
6515
6516
static PyMethodDef __pyx_methods_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep[] = {
6517
{"mod_ell_image", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_3mod_ell_image, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_2mod_ell_image},
6518
{"mod_ell_images", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_5mod_ell_images, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_4mod_ell_images},
6519
{"non_surjective_primes", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_7non_surjective_primes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_6non_surjective_primes},
6520
{0, 0, 0, 0}
6521
};
6522
6523
static PyTypeObject __pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep = {
6524
PyVarObject_HEAD_INIT(0, 0)
6525
"code.alex.psage.psage.ellcurve.galrep.wrapper.GalRep", /*tp_name*/
6526
sizeof(struct __pyx_obj_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep), /*tp_basicsize*/
6527
0, /*tp_itemsize*/
6528
__pyx_tp_dealloc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, /*tp_dealloc*/
6529
0, /*tp_print*/
6530
0, /*tp_getattr*/
6531
0, /*tp_setattr*/
6532
#if PY_MAJOR_VERSION < 3
6533
0, /*tp_compare*/
6534
#endif
6535
#if PY_MAJOR_VERSION >= 3
6536
0, /*tp_as_async*/
6537
#endif
6538
__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_9__repr__, /*tp_repr*/
6539
0, /*tp_as_number*/
6540
0, /*tp_as_sequence*/
6541
0, /*tp_as_mapping*/
6542
0, /*tp_hash*/
6543
0, /*tp_call*/
6544
0, /*tp_str*/
6545
0, /*tp_getattro*/
6546
0, /*tp_setattro*/
6547
0, /*tp_as_buffer*/
6548
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
6549
"File: wrapper.pyx (starting at line 49)\n\n Andrew Sutherland's Probabilistic Image of Galois Algorithm\n ", /*tp_doc*/
6550
__pyx_tp_traverse_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, /*tp_traverse*/
6551
__pyx_tp_clear_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, /*tp_clear*/
6552
0, /*tp_richcompare*/
6553
0, /*tp_weaklistoffset*/
6554
0, /*tp_iter*/
6555
0, /*tp_iternext*/
6556
__pyx_methods_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, /*tp_methods*/
6557
0, /*tp_members*/
6558
0, /*tp_getset*/
6559
0, /*tp_base*/
6560
0, /*tp_dict*/
6561
0, /*tp_descr_get*/
6562
0, /*tp_descr_set*/
6563
0, /*tp_dictoffset*/
6564
__pyx_pw_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_1__init__, /*tp_init*/
6565
0, /*tp_alloc*/
6566
__pyx_tp_new_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, /*tp_new*/
6567
0, /*tp_free*/
6568
0, /*tp_is_gc*/
6569
0, /*tp_bases*/
6570
0, /*tp_mro*/
6571
0, /*tp_cache*/
6572
0, /*tp_subclasses*/
6573
0, /*tp_weaklist*/
6574
0, /*tp_del*/
6575
0, /*tp_version_tag*/
6576
#if PY_VERSION_HEX >= 0x030400a1
6577
0, /*tp_finalize*/
6578
#endif
6579
};
6580
6581
static struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py[8];
6582
static int __pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = 0;
6583
6584
static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
6585
PyObject *o;
6586
if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py)))) {
6587
o = (PyObject*)__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py[--__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py];
6588
memset(o, 0, sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py));
6589
(void) PyObject_INIT(o, t);
6590
} else {
6591
o = (*t->tp_alloc)(t, 0);
6592
if (unlikely(!o)) return 0;
6593
}
6594
return o;
6595
}
6596
6597
static void __pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py(PyObject *o) {
6598
if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py)))) {
6599
__pyx_freelist___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py[__pyx_freecount___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py++] = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py *)o);
6600
} else {
6601
(*Py_TYPE(o)->tp_free)(o);
6602
}
6603
}
6604
6605
static PyTypeObject __pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = {
6606
PyVarObject_HEAD_INIT(0, 0)
6607
"code.alex.psage.psage.ellcurve.galrep.wrapper.__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py", /*tp_name*/
6608
sizeof(struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py), /*tp_basicsize*/
6609
0, /*tp_itemsize*/
6610
__pyx_tp_dealloc___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, /*tp_dealloc*/
6611
0, /*tp_print*/
6612
0, /*tp_getattr*/
6613
0, /*tp_setattr*/
6614
#if PY_MAJOR_VERSION < 3
6615
0, /*tp_compare*/
6616
#endif
6617
#if PY_MAJOR_VERSION >= 3
6618
0, /*tp_as_async*/
6619
#endif
6620
0, /*tp_repr*/
6621
0, /*tp_as_number*/
6622
0, /*tp_as_sequence*/
6623
0, /*tp_as_mapping*/
6624
0, /*tp_hash*/
6625
0, /*tp_call*/
6626
0, /*tp_str*/
6627
0, /*tp_getattro*/
6628
0, /*tp_setattro*/
6629
0, /*tp_as_buffer*/
6630
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
6631
0, /*tp_doc*/
6632
0, /*tp_traverse*/
6633
0, /*tp_clear*/
6634
0, /*tp_richcompare*/
6635
0, /*tp_weaklistoffset*/
6636
0, /*tp_iter*/
6637
0, /*tp_iternext*/
6638
0, /*tp_methods*/
6639
0, /*tp_members*/
6640
0, /*tp_getset*/
6641
0, /*tp_base*/
6642
0, /*tp_dict*/
6643
0, /*tp_descr_get*/
6644
0, /*tp_descr_set*/
6645
0, /*tp_dictoffset*/
6646
0, /*tp_init*/
6647
0, /*tp_alloc*/
6648
__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py, /*tp_new*/
6649
0, /*tp_free*/
6650
0, /*tp_is_gc*/
6651
0, /*tp_bases*/
6652
0, /*tp_mro*/
6653
0, /*tp_cache*/
6654
0, /*tp_subclasses*/
6655
0, /*tp_weaklist*/
6656
0, /*tp_del*/
6657
0, /*tp_version_tag*/
6658
#if PY_VERSION_HEX >= 0x030400a1
6659
0, /*tp_finalize*/
6660
#endif
6661
};
6662
6663
static PyMethodDef __pyx_methods[] = {
6664
{0, 0, 0, 0}
6665
};
6666
6667
#if PY_MAJOR_VERSION >= 3
6668
static struct PyModuleDef __pyx_moduledef = {
6669
#if PY_VERSION_HEX < 0x03020000
6670
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
6671
#else
6672
PyModuleDef_HEAD_INIT,
6673
#endif
6674
"wrapper",
6675
__pyx_k_File_wrapper_pyx_starting_at_lin, /* m_doc */
6676
-1, /* m_size */
6677
__pyx_methods /* m_methods */,
6678
NULL, /* m_reload */
6679
NULL, /* m_traverse */
6680
NULL, /* m_clear */
6681
NULL /* m_free */
6682
};
6683
#endif
6684
6685
static __Pyx_StringTabEntry __pyx_string_tab[] = {
6686
{&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
6687
{&__pyx_kp_s_Andrew_Sutherland_s_Probabilisti, __pyx_k_Andrew_Sutherland_s_Probabilisti, sizeof(__pyx_k_Andrew_Sutherland_s_Probabilisti), 0, 0, 1, 0},
6688
{&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
6689
{&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
6690
{&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
6691
{&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
6692
{&__pyx_n_s_Pyx_CFunc_object____object, __pyx_k_Pyx_CFunc_object____object, sizeof(__pyx_k_Pyx_CFunc_object____object), 0, 0, 1, 1},
6693
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
6694
{&__pyx_n_s_abspath, __pyx_k_abspath, sizeof(__pyx_k_abspath), 0, 0, 1, 1},
6695
{&__pyx_n_s_arg0, __pyx_k_arg0, sizeof(__pyx_k_arg0), 0, 0, 1, 1},
6696
{&__pyx_n_s_arg1, __pyx_k_arg1, sizeof(__pyx_k_arg1), 0, 0, 1, 1},
6697
{&__pyx_n_s_arg2, __pyx_k_arg2, sizeof(__pyx_k_arg2), 0, 0, 1, 1},
6698
{&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
6699
{&__pyx_n_s_cfunc_to_py, __pyx_k_cfunc_to_py, sizeof(__pyx_k_cfunc_to_py), 0, 0, 1, 1},
6700
{&__pyx_n_s_dirname, __pyx_k_dirname, sizeof(__pyx_k_dirname), 0, 0, 1, 1},
6701
{&__pyx_n_s_ell, __pyx_k_ell, sizeof(__pyx_k_ell), 0, 0, 1, 1},
6702
{&__pyx_kp_s_ell_s_must_be_a_prime_s, __pyx_k_ell_s_must_be_a_prime_s, sizeof(__pyx_k_ell_s_must_be_a_prime_s), 0, 0, 1, 0},
6703
{&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1},
6704
{&__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},
6705
{&__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},
6706
{&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
6707
{&__pyx_n_s_galrep_ecdata, __pyx_k_galrep_ecdata, sizeof(__pyx_k_galrep_ecdata), 0, 0, 1, 1},
6708
{&__pyx_kp_s_galrep_ecdata_dat, __pyx_k_galrep_ecdata_dat, sizeof(__pyx_k_galrep_ecdata_dat), 0, 0, 1, 0},
6709
{&__pyx_n_s_galrep_gl2data, __pyx_k_galrep_gl2data, sizeof(__pyx_k_galrep_gl2data), 0, 0, 1, 1},
6710
{&__pyx_kp_s_galrep_gl2data_dat, __pyx_k_galrep_gl2data_dat, sizeof(__pyx_k_galrep_gl2data_dat), 0, 0, 1, 0},
6711
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
6712
{&__pyx_n_s_init_memory_functions, __pyx_k_init_memory_functions, sizeof(__pyx_k_init_memory_functions), 0, 0, 1, 1},
6713
{&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
6714
{&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
6715
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
6716
{&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
6717
{&__pyx_kp_s_max_must_be_bigger_than_min, __pyx_k_max_must_be_bigger_than_min, sizeof(__pyx_k_max_must_be_bigger_than_min), 0, 0, 1, 0},
6718
{&__pyx_kp_s_max_must_be_s, __pyx_k_max_must_be_s, sizeof(__pyx_k_max_must_be_s), 0, 0, 1, 0},
6719
{&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
6720
{&__pyx_kp_s_min_and_max_must_be_s, __pyx_k_min_and_max_must_be_s, sizeof(__pyx_k_min_and_max_must_be_s), 0, 0, 1, 0},
6721
{&__pyx_kp_s_no_file_s, __pyx_k_no_file_s, sizeof(__pyx_k_no_file_s), 0, 0, 1, 0},
6722
{&__pyx_n_s_op, __pyx_k_op, sizeof(__pyx_k_op), 0, 0, 1, 1},
6723
{&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
6724
{&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
6725
{&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
6726
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
6727
{&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
6728
{&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
6729
{&__pyx_n_s_sage_ext_memory, __pyx_k_sage_ext_memory, sizeof(__pyx_k_sage_ext_memory), 0, 0, 1, 1},
6730
{&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
6731
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
6732
{&__pyx_n_s_wrap, __pyx_k_wrap, sizeof(__pyx_k_wrap), 0, 0, 1, 1},
6733
{&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
6734
{&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
6735
{0, 0, 0, 0, 0, 0, 0}
6736
};
6737
static int __Pyx_InitCachedBuiltins(void) {
6738
__pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 77, __pyx_L1_error)
6739
__pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 116, __pyx_L1_error)
6740
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 150, __pyx_L1_error)
6741
__pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(1, 70, __pyx_L1_error)
6742
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 91, __pyx_L1_error)
6743
return 0;
6744
__pyx_L1_error:;
6745
return -1;
6746
}
6747
6748
static int __Pyx_InitCachedConstants(void) {
6749
__Pyx_RefNannyDeclarations
6750
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
6751
6752
/* "cfunc.to_py":65
6753
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
6754
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ):
6755
* def wrap(object arg0, object arg1, int arg2): # <<<<<<<<<<<<<<
6756
* """wrap(arg0, arg1, arg2: 'int')"""
6757
* return f(arg0, arg1, arg2)
6758
*/
6759
__pyx_tuple_ = PyTuple_Pack(3, __pyx_n_s_arg0, __pyx_n_s_arg1, __pyx_n_s_arg2); if (unlikely(!__pyx_tuple_)) __PYX_ERR(5, 65, __pyx_L1_error)
6760
__Pyx_GOTREF(__pyx_tuple_);
6761
__Pyx_GIVEREF(__pyx_tuple_);
6762
__pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(5, 65, __pyx_L1_error)
6763
__Pyx_RefNannyFinishContext();
6764
return 0;
6765
__pyx_L1_error:;
6766
__Pyx_RefNannyFinishContext();
6767
return -1;
6768
}
6769
6770
static int __Pyx_InitGlobals(void) {
6771
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6772
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
6773
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
6774
__pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
6775
__pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
6776
__pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) __PYX_ERR(0, 1, __pyx_L1_error)
6777
__pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) __PYX_ERR(0, 1, __pyx_L1_error)
6778
__pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) __PYX_ERR(0, 1, __pyx_L1_error)
6779
__pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) __PYX_ERR(0, 1, __pyx_L1_error)
6780
__pyx_int_23 = PyInt_FromLong(23); if (unlikely(!__pyx_int_23)) __PYX_ERR(0, 1, __pyx_L1_error)
6781
__pyx_int_29 = PyInt_FromLong(29); if (unlikely(!__pyx_int_29)) __PYX_ERR(0, 1, __pyx_L1_error)
6782
__pyx_int_31 = PyInt_FromLong(31); if (unlikely(!__pyx_int_31)) __PYX_ERR(0, 1, __pyx_L1_error)
6783
__pyx_int_37 = PyInt_FromLong(37); if (unlikely(!__pyx_int_37)) __PYX_ERR(0, 1, __pyx_L1_error)
6784
__pyx_int_41 = PyInt_FromLong(41); if (unlikely(!__pyx_int_41)) __PYX_ERR(0, 1, __pyx_L1_error)
6785
__pyx_int_43 = PyInt_FromLong(43); if (unlikely(!__pyx_int_43)) __PYX_ERR(0, 1, __pyx_L1_error)
6786
__pyx_int_47 = PyInt_FromLong(47); if (unlikely(!__pyx_int_47)) __PYX_ERR(0, 1, __pyx_L1_error)
6787
__pyx_int_53 = PyInt_FromLong(53); if (unlikely(!__pyx_int_53)) __PYX_ERR(0, 1, __pyx_L1_error)
6788
__pyx_int_59 = PyInt_FromLong(59); if (unlikely(!__pyx_int_59)) __PYX_ERR(0, 1, __pyx_L1_error)
6789
return 0;
6790
__pyx_L1_error:;
6791
return -1;
6792
}
6793
6794
#if PY_MAJOR_VERSION < 3
6795
PyMODINIT_FUNC initwrapper(void); /*proto*/
6796
PyMODINIT_FUNC initwrapper(void)
6797
#else
6798
PyMODINIT_FUNC PyInit_wrapper(void); /*proto*/
6799
PyMODINIT_FUNC PyInit_wrapper(void)
6800
#endif
6801
{
6802
PyObject *__pyx_t_1 = NULL;
6803
PyObject *__pyx_t_2 = NULL;
6804
int __pyx_t_3;
6805
PyObject *__pyx_t_4 = NULL;
6806
PyObject *__pyx_t_5 = NULL;
6807
__Pyx_RefNannyDeclarations
6808
#if CYTHON_REFNANNY
6809
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
6810
if (!__Pyx_RefNanny) {
6811
PyErr_Clear();
6812
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
6813
if (!__Pyx_RefNanny)
6814
Py_FatalError("failed to import 'refnanny' module");
6815
}
6816
#endif
6817
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_wrapper(void)", 0);
6818
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6819
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
6820
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
6821
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
6822
#ifdef __Pyx_CyFunction_USED
6823
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6824
#endif
6825
#ifdef __Pyx_FusedFunction_USED
6826
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6827
#endif
6828
#ifdef __Pyx_Coroutine_USED
6829
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6830
#endif
6831
#ifdef __Pyx_Generator_USED
6832
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6833
#endif
6834
#ifdef __Pyx_StopAsyncIteration_USED
6835
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6836
#endif
6837
/*--- Library function declarations ---*/
6838
/*--- Threads initialization code ---*/
6839
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
6840
#ifdef WITH_THREAD /* Python build with threading support? */
6841
PyEval_InitThreads();
6842
#endif
6843
#endif
6844
/*--- Module creation code ---*/
6845
#if PY_MAJOR_VERSION < 3
6846
__pyx_m = Py_InitModule4("wrapper", __pyx_methods, __pyx_k_File_wrapper_pyx_starting_at_lin, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
6847
#else
6848
__pyx_m = PyModule_Create(&__pyx_moduledef);
6849
#endif
6850
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
6851
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
6852
Py_INCREF(__pyx_d);
6853
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
6854
#if CYTHON_COMPILING_IN_PYPY
6855
Py_INCREF(__pyx_b);
6856
#endif
6857
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6858
/*--- Initialize various global constants etc. ---*/
6859
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6860
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
6861
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6862
#endif
6863
if (__pyx_module_is_main_code__alex__psage__psage__ellcurve__galrep__wrapper) {
6864
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6865
}
6866
#if PY_MAJOR_VERSION >= 3
6867
{
6868
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
6869
if (!PyDict_GetItemString(modules, "code.alex.psage.psage.ellcurve.galrep.wrapper")) {
6870
if (unlikely(PyDict_SetItemString(modules, "code.alex.psage.psage.ellcurve.galrep.wrapper", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6871
}
6872
}
6873
#endif
6874
/*--- Builtin init code ---*/
6875
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6876
/*--- Constants init code ---*/
6877
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6878
/*--- Global init code ---*/
6879
/*--- Variable export code ---*/
6880
/*--- Function export code ---*/
6881
/*--- Type init code ---*/
6882
if (PyType_Ready(&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
6883
__pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep.tp_print = 0;
6884
#if CYTHON_COMPILING_IN_CPYTHON
6885
{
6886
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 49, __pyx_L1_error)
6887
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
6888
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
6889
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__.doc = __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__;
6890
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep___init__;
6891
}
6892
}
6893
#endif
6894
#if CYTHON_COMPILING_IN_CPYTHON
6895
{
6896
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 49, __pyx_L1_error)
6897
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
6898
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
6899
__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__.doc = __pyx_doc_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__;
6900
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_6GalRep_8__repr__;
6901
}
6902
}
6903
#endif
6904
if (PyObject_SetAttrString(__pyx_m, "GalRep", (PyObject *)&__pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
6905
__pyx_ptype_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep = &__pyx_type_4code_4alex_5psage_5psage_8ellcurve_6galrep_7wrapper_GalRep;
6906
if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py) < 0) __PYX_ERR(5, 64, __pyx_L1_error)
6907
__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py.tp_print = 0;
6908
__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py = &__pyx_scope_struct____Pyx_CFunc_object____object____object____int___to_py;
6909
/*--- Type import code ---*/
6910
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
6911
#if CYTHON_COMPILING_IN_PYPY
6912
sizeof(PyTypeObject),
6913
#else
6914
sizeof(PyHeapTypeObject),
6915
#endif
6916
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(6, 9, __pyx_L1_error)
6917
__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(7, 8, __pyx_L1_error)
6918
__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(8, 15, __pyx_L1_error)
6919
__pyx_ptype_4sage_9structure_11sage_object_SageObject = __Pyx_ImportType("sage.structure.sage_object", "SageObject", sizeof(struct __pyx_obj_4sage_9structure_11sage_object_SageObject), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11sage_object_SageObject)) __PYX_ERR(3, 9, __pyx_L1_error)
6920
__pyx_ptype_4sage_9structure_15category_object_CategoryObject = __Pyx_ImportType("sage.structure.category_object", "CategoryObject", sizeof(struct __pyx_obj_4sage_9structure_15category_object_CategoryObject), 1); if (unlikely(!__pyx_ptype_4sage_9structure_15category_object_CategoryObject)) __PYX_ERR(9, 15, __pyx_L1_error)
6921
__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject = (struct __pyx_vtabstruct_4sage_9structure_15category_object_CategoryObject*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_15category_object_CategoryObject->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_15category_object_CategoryObject)) __PYX_ERR(9, 15, __pyx_L1_error)
6922
__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict = __Pyx_ImportType("sage.structure.coerce_dict", "MonoDict", sizeof(struct __pyx_obj_4sage_9structure_11coerce_dict_MonoDict), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict)) __PYX_ERR(10, 7, __pyx_L1_error)
6923
__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict = (struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_MonoDict*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11coerce_dict_MonoDict->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11coerce_dict_MonoDict)) __PYX_ERR(10, 7, __pyx_L1_error)
6924
__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict = __Pyx_ImportType("sage.structure.coerce_dict", "TripleDict", sizeof(struct __pyx_obj_4sage_9structure_11coerce_dict_TripleDict), 1); if (unlikely(!__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict)) __PYX_ERR(10, 23, __pyx_L1_error)
6925
__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict = (struct __pyx_vtabstruct_4sage_9structure_11coerce_dict_TripleDict*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_11coerce_dict_TripleDict->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_11coerce_dict_TripleDict)) __PYX_ERR(10, 23, __pyx_L1_error)
6926
__pyx_ptype_4sage_9structure_6parent_Parent = __Pyx_ImportType("sage.structure.parent", "Parent", sizeof(struct __pyx_obj_4sage_9structure_6parent_Parent), 1); if (unlikely(!__pyx_ptype_4sage_9structure_6parent_Parent)) __PYX_ERR(11, 12, __pyx_L1_error)
6927
__pyx_vtabptr_4sage_9structure_6parent_Parent = (struct __pyx_vtabstruct_4sage_9structure_6parent_Parent*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_6parent_Parent->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_6parent_Parent)) __PYX_ERR(11, 12, __pyx_L1_error)
6928
__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass = __Pyx_ImportType("sage.misc.inherit_comparison", "InheritComparisonMetaclass", sizeof(struct __pyx_obj_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass), 1); if (unlikely(!__pyx_ptype_4sage_4misc_18inherit_comparison_InheritComparisonMetaclass)) __PYX_ERR(12, 3, __pyx_L1_error)
6929
__pyx_ptype_4sage_9structure_7element_Element = __Pyx_ImportType("sage.structure.element", "Element", sizeof(struct __pyx_obj_4sage_9structure_7element_Element), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_Element)) __PYX_ERR(1, 169, __pyx_L1_error)
6930
__pyx_vtabptr_4sage_9structure_7element_Element = (struct __pyx_vtabstruct_4sage_9structure_7element_Element*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Element->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Element)) __PYX_ERR(1, 169, __pyx_L1_error)
6931
__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod = __Pyx_ImportType("sage.structure.element", "ElementWithCachedMethod", sizeof(struct __pyx_obj_4sage_9structure_7element_ElementWithCachedMethod), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod)) __PYX_ERR(1, 192, __pyx_L1_error)
6932
__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod = (struct __pyx_vtabstruct_4sage_9structure_7element_ElementWithCachedMethod*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ElementWithCachedMethod->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ElementWithCachedMethod)) __PYX_ERR(1, 192, __pyx_L1_error)
6933
__pyx_ptype_4sage_9structure_7element_ModuleElement = __Pyx_ImportType("sage.structure.element", "ModuleElement", sizeof(struct __pyx_obj_4sage_9structure_7element_ModuleElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_ModuleElement)) __PYX_ERR(1, 195, __pyx_L1_error)
6934
__pyx_vtabptr_4sage_9structure_7element_ModuleElement = (struct __pyx_vtabstruct_4sage_9structure_7element_ModuleElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_ModuleElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_ModuleElement)) __PYX_ERR(1, 195, __pyx_L1_error)
6935
__pyx_ptype_4sage_9structure_7element_RingElement = __Pyx_ImportType("sage.structure.element", "RingElement", sizeof(struct __pyx_obj_4sage_9structure_7element_RingElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_RingElement)) __PYX_ERR(1, 197, __pyx_L1_error)
6936
__pyx_vtabptr_4sage_9structure_7element_RingElement = (struct __pyx_vtabstruct_4sage_9structure_7element_RingElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_RingElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_RingElement)) __PYX_ERR(1, 197, __pyx_L1_error)
6937
__pyx_ptype_4sage_9structure_7element_MonoidElement = __Pyx_ImportType("sage.structure.element", "MonoidElement", sizeof(struct __pyx_obj_4sage_9structure_7element_MonoidElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_MonoidElement)) __PYX_ERR(1, 208, __pyx_L1_error)
6938
__pyx_vtabptr_4sage_9structure_7element_MonoidElement = (struct __pyx_vtabstruct_4sage_9structure_7element_MonoidElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_MonoidElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_MonoidElement)) __PYX_ERR(1, 208, __pyx_L1_error)
6939
__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement = __Pyx_ImportType("sage.structure.element", "MultiplicativeGroupElement", sizeof(struct __pyx_obj_4sage_9structure_7element_MultiplicativeGroupElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement)) __PYX_ERR(1, 211, __pyx_L1_error)
6940
__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement = (struct __pyx_vtabstruct_4sage_9structure_7element_MultiplicativeGroupElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_MultiplicativeGroupElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_MultiplicativeGroupElement)) __PYX_ERR(1, 211, __pyx_L1_error)
6941
__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement = __Pyx_ImportType("sage.structure.element", "AdditiveGroupElement", sizeof(struct __pyx_obj_4sage_9structure_7element_AdditiveGroupElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement)) __PYX_ERR(1, 214, __pyx_L1_error)
6942
__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement = (struct __pyx_vtabstruct_4sage_9structure_7element_AdditiveGroupElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_AdditiveGroupElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_AdditiveGroupElement)) __PYX_ERR(1, 214, __pyx_L1_error)
6943
__pyx_ptype_4sage_9structure_7element_CommutativeRingElement = __Pyx_ImportType("sage.structure.element", "CommutativeRingElement", sizeof(struct __pyx_obj_4sage_9structure_7element_CommutativeRingElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_CommutativeRingElement)) __PYX_ERR(1, 220, __pyx_L1_error)
6944
__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement = (struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeRingElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CommutativeRingElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CommutativeRingElement)) __PYX_ERR(1, 220, __pyx_L1_error)
6945
__pyx_ptype_4sage_9structure_7element_IntegralDomainElement = __Pyx_ImportType("sage.structure.element", "IntegralDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_IntegralDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_IntegralDomainElement)) __PYX_ERR(1, 223, __pyx_L1_error)
6946
__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_IntegralDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_IntegralDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_IntegralDomainElement)) __PYX_ERR(1, 223, __pyx_L1_error)
6947
__pyx_ptype_4sage_9structure_7element_DedekindDomainElement = __Pyx_ImportType("sage.structure.element", "DedekindDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_DedekindDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_DedekindDomainElement)) __PYX_ERR(1, 226, __pyx_L1_error)
6948
__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_DedekindDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_DedekindDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_DedekindDomainElement)) __PYX_ERR(1, 226, __pyx_L1_error)
6949
__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement = __Pyx_ImportType("sage.structure.element", "PrincipalIdealDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_PrincipalIdealDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement)) __PYX_ERR(1, 229, __pyx_L1_error)
6950
__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_PrincipalIdealDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_PrincipalIdealDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_PrincipalIdealDomainElement)) __PYX_ERR(1, 229, __pyx_L1_error)
6951
__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement = __Pyx_ImportType("sage.structure.element", "EuclideanDomainElement", sizeof(struct __pyx_obj_4sage_9structure_7element_EuclideanDomainElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement)) __PYX_ERR(1, 232, __pyx_L1_error)
6952
__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement = (struct __pyx_vtabstruct_4sage_9structure_7element_EuclideanDomainElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_EuclideanDomainElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_EuclideanDomainElement)) __PYX_ERR(1, 232, __pyx_L1_error)
6953
__pyx_ptype_4sage_9structure_7element_FieldElement = __Pyx_ImportType("sage.structure.element", "FieldElement", sizeof(struct __pyx_obj_4sage_9structure_7element_FieldElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_FieldElement)) __PYX_ERR(1, 236, __pyx_L1_error)
6954
__pyx_vtabptr_4sage_9structure_7element_FieldElement = (struct __pyx_vtabstruct_4sage_9structure_7element_FieldElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_FieldElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_FieldElement)) __PYX_ERR(1, 236, __pyx_L1_error)
6955
__pyx_ptype_4sage_9structure_7element_AlgebraElement = __Pyx_ImportType("sage.structure.element", "AlgebraElement", sizeof(struct __pyx_obj_4sage_9structure_7element_AlgebraElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_AlgebraElement)) __PYX_ERR(1, 239, __pyx_L1_error)
6956
__pyx_vtabptr_4sage_9structure_7element_AlgebraElement = (struct __pyx_vtabstruct_4sage_9structure_7element_AlgebraElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_AlgebraElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_AlgebraElement)) __PYX_ERR(1, 239, __pyx_L1_error)
6957
__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement = __Pyx_ImportType("sage.structure.element", "CommutativeAlgebraElement", sizeof(struct __pyx_obj_4sage_9structure_7element_CommutativeAlgebraElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement)) __PYX_ERR(1, 242, __pyx_L1_error)
6958
__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement = (struct __pyx_vtabstruct_4sage_9structure_7element_CommutativeAlgebraElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CommutativeAlgebraElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CommutativeAlgebraElement)) __PYX_ERR(1, 242, __pyx_L1_error)
6959
__pyx_ptype_4sage_9structure_7element_InfinityElement = __Pyx_ImportType("sage.structure.element", "InfinityElement", sizeof(struct __pyx_obj_4sage_9structure_7element_InfinityElement), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_InfinityElement)) __PYX_ERR(1, 245, __pyx_L1_error)
6960
__pyx_vtabptr_4sage_9structure_7element_InfinityElement = (struct __pyx_vtabstruct_4sage_9structure_7element_InfinityElement*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_InfinityElement->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_InfinityElement)) __PYX_ERR(1, 245, __pyx_L1_error)
6961
__pyx_ptype_4sage_9structure_7element_Vector = __Pyx_ImportType("sage.structure.element", "Vector", sizeof(struct __pyx_obj_4sage_9structure_7element_Vector), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_Vector)) __PYX_ERR(1, 249, __pyx_L1_error)
6962
__pyx_vtabptr_4sage_9structure_7element_Vector = (struct __pyx_vtabstruct_4sage_9structure_7element_Vector*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Vector->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Vector)) __PYX_ERR(1, 249, __pyx_L1_error)
6963
__pyx_ptype_4sage_9structure_7element_Matrix = __Pyx_ImportType("sage.structure.element", "Matrix", sizeof(struct __pyx_obj_4sage_9structure_7element_Matrix), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_Matrix)) __PYX_ERR(1, 264, __pyx_L1_error)
6964
__pyx_vtabptr_4sage_9structure_7element_Matrix = (struct __pyx_vtabstruct_4sage_9structure_7element_Matrix*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_Matrix->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_Matrix)) __PYX_ERR(1, 264, __pyx_L1_error)
6965
__pyx_ptype_4sage_9structure_7element_CoercionModel = __Pyx_ImportType("sage.structure.element", "CoercionModel", sizeof(struct __pyx_obj_4sage_9structure_7element_CoercionModel), 1); if (unlikely(!__pyx_ptype_4sage_9structure_7element_CoercionModel)) __PYX_ERR(1, 277, __pyx_L1_error)
6966
__pyx_vtabptr_4sage_9structure_7element_CoercionModel = (struct __pyx_vtabstruct_4sage_9structure_7element_CoercionModel*)__Pyx_GetVtable(__pyx_ptype_4sage_9structure_7element_CoercionModel->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_9structure_7element_CoercionModel)) __PYX_ERR(1, 277, __pyx_L1_error)
6967
__pyx_ptype_4sage_10categories_3map_Map = __Pyx_ImportType("sage.categories.map", "Map", sizeof(struct __pyx_obj_4sage_10categories_3map_Map), 1); if (unlikely(!__pyx_ptype_4sage_10categories_3map_Map)) __PYX_ERR(13, 4, __pyx_L1_error)
6968
__pyx_vtabptr_4sage_10categories_3map_Map = (struct __pyx_vtabstruct_4sage_10categories_3map_Map*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_Map->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_Map)) __PYX_ERR(13, 4, __pyx_L1_error)
6969
__pyx_ptype_4sage_10categories_3map_Section = __Pyx_ImportType("sage.categories.map", "Section", sizeof(struct __pyx_obj_4sage_10categories_3map_Section), 1); if (unlikely(!__pyx_ptype_4sage_10categories_3map_Section)) __PYX_ERR(13, 25, __pyx_L1_error)
6970
__pyx_vtabptr_4sage_10categories_3map_Section = (struct __pyx_vtabstruct_4sage_10categories_3map_Section*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_Section->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_Section)) __PYX_ERR(13, 25, __pyx_L1_error)
6971
__pyx_ptype_4sage_10categories_3map_FormalCompositeMap = __Pyx_ImportType("sage.categories.map", "FormalCompositeMap", sizeof(struct __pyx_obj_4sage_10categories_3map_FormalCompositeMap), 1); if (unlikely(!__pyx_ptype_4sage_10categories_3map_FormalCompositeMap)) __PYX_ERR(13, 28, __pyx_L1_error)
6972
__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap = (struct __pyx_vtabstruct_4sage_10categories_3map_FormalCompositeMap*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_3map_FormalCompositeMap->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_3map_FormalCompositeMap)) __PYX_ERR(13, 28, __pyx_L1_error)
6973
__pyx_ptype_4sage_10categories_8morphism_Morphism = __Pyx_ImportType("sage.categories.morphism", "Morphism", sizeof(struct __pyx_obj_4sage_10categories_8morphism_Morphism), 1); if (unlikely(!__pyx_ptype_4sage_10categories_8morphism_Morphism)) __PYX_ERR(14, 5, __pyx_L1_error)
6974
__pyx_vtabptr_4sage_10categories_8morphism_Morphism = (struct __pyx_vtabstruct_4sage_10categories_8morphism_Morphism*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_8morphism_Morphism->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_8morphism_Morphism)) __PYX_ERR(14, 5, __pyx_L1_error)
6975
__pyx_ptype_4sage_10categories_8morphism_SetMorphism = __Pyx_ImportType("sage.categories.morphism", "SetMorphism", sizeof(struct __pyx_obj_4sage_10categories_8morphism_SetMorphism), 1); if (unlikely(!__pyx_ptype_4sage_10categories_8morphism_SetMorphism)) __PYX_ERR(14, 8, __pyx_L1_error)
6976
__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism = (struct __pyx_vtabstruct_4sage_10categories_8morphism_SetMorphism*)__Pyx_GetVtable(__pyx_ptype_4sage_10categories_8morphism_SetMorphism->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_10categories_8morphism_SetMorphism)) __PYX_ERR(14, 8, __pyx_L1_error)
6977
__pyx_ptype_4sage_5rings_7integer_Integer = __Pyx_ImportType("sage.rings.integer", "Integer", sizeof(struct __pyx_obj_4sage_5rings_7integer_Integer), 1); if (unlikely(!__pyx_ptype_4sage_5rings_7integer_Integer)) __PYX_ERR(15, 7, __pyx_L1_error)
6978
__pyx_vtabptr_4sage_5rings_7integer_Integer = (struct __pyx_vtabstruct_4sage_5rings_7integer_Integer*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_7integer_Integer->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_7integer_Integer)) __PYX_ERR(15, 7, __pyx_L1_error)
6979
__pyx_ptype_4sage_5rings_7integer_int_to_Z = __Pyx_ImportType("sage.rings.integer", "int_to_Z", sizeof(struct __pyx_obj_4sage_5rings_7integer_int_to_Z), 1); if (unlikely(!__pyx_ptype_4sage_5rings_7integer_int_to_Z)) __PYX_ERR(15, 37, __pyx_L1_error)
6980
__pyx_vtabptr_4sage_5rings_7integer_int_to_Z = (struct __pyx_vtabstruct_4sage_5rings_7integer_int_to_Z*)__Pyx_GetVtable(__pyx_ptype_4sage_5rings_7integer_int_to_Z->tp_dict); if (unlikely(!__pyx_vtabptr_4sage_5rings_7integer_int_to_Z)) __PYX_ERR(15, 37, __pyx_L1_error)
6981
/*--- Variable import code ---*/
6982
__pyx_t_1 = __Pyx_ImportModule("cysignals.signals"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
6983
if (__Pyx_ImportVoidPtr(__pyx_t_1, "cysigs", (void **)&__pyx_vp_9cysignals_7signals_cysigs, "cysigs_t") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6984
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6985
__pyx_t_2 = __Pyx_ImportModule("sage.structure.element"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error)
6986
if (__Pyx_ImportVoidPtr(__pyx_t_2, "coercion_model", (void **)&__pyx_vp_4sage_9structure_7element_coercion_model, "struct __pyx_obj_4sage_9structure_7element_CoercionModel *") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6987
Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6988
/*--- Function import code ---*/
6989
/*--- Execution code ---*/
6990
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
6991
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6992
#endif
6993
6994
/* "../../../../../../../sage/sage-7.5/local/lib/python2.7/site-packages/cysignals/signals.pxi":24
6995
* # This *must* be done for every module using interrupt functions
6996
* # otherwise you will get segmentation faults.
6997
* import_cysignals__signals() # <<<<<<<<<<<<<<
6998
*/
6999
__pyx_t_3 = import_cysignals__signals(); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(16, 24, __pyx_L1_error)
7000
7001
/* "../../../../../../../sage/sage-7.5/src/sage/ext/stdsage.pxi":24
7002
*
7003
* from sage.ext.stdsage cimport PY_NEW, HAS_DICTIONARY
7004
* from sage.ext.memory import init_memory_functions # <<<<<<<<<<<<<<
7005
*/
7006
__pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 24, __pyx_L1_error)
7007
__Pyx_GOTREF(__pyx_t_4);
7008
__Pyx_INCREF(__pyx_n_s_init_memory_functions);
7009
__Pyx_GIVEREF(__pyx_n_s_init_memory_functions);
7010
PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_init_memory_functions);
7011
__pyx_t_5 = __Pyx_Import(__pyx_n_s_sage_ext_memory, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(17, 24, __pyx_L1_error)
7012
__Pyx_GOTREF(__pyx_t_5);
7013
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7014
__pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_init_memory_functions); if (unlikely(!__pyx_t_4)) __PYX_ERR(17, 24, __pyx_L1_error)
7015
__Pyx_GOTREF(__pyx_t_4);
7016
if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_memory_functions, __pyx_t_4) < 0) __PYX_ERR(17, 24, __pyx_L1_error)
7017
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7018
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7019
7020
/* "code/alex/psage/psage/ellcurve/galrep/wrapper.pyx":1
7021
* """ # <<<<<<<<<<<<<<
7022
* Andrew Sutherland's Probabilistic Image of Galois Algorithm
7023
*
7024
*/
7025
__pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error)
7026
__Pyx_GOTREF(__pyx_t_5);
7027
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7028
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7029
7030
/* "cfunc.to_py":64
7031
*
7032
* @cname("__Pyx_CFunc_object____object____object____int___to_py")
7033
* cdef object __Pyx_CFunc_object____object____object____int___to_py(object (*f)(object, object, int) ): # <<<<<<<<<<<<<<
7034
* def wrap(object arg0, object arg1, int arg2):
7035
* """wrap(arg0, arg1, arg2: 'int')"""
7036
*/
7037
7038
/*--- Wrapped vars code ---*/
7039
7040
goto __pyx_L0;
7041
__pyx_L1_error:;
7042
__Pyx_XDECREF(__pyx_t_1);
7043
__Pyx_XDECREF(__pyx_t_2);
7044
__Pyx_XDECREF(__pyx_t_4);
7045
__Pyx_XDECREF(__pyx_t_5);
7046
if (__pyx_m) {
7047
if (__pyx_d) {
7048
__Pyx_AddTraceback("init code.alex.psage.psage.ellcurve.galrep.wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
7049
}
7050
Py_DECREF(__pyx_m); __pyx_m = 0;
7051
} else if (!PyErr_Occurred()) {
7052
PyErr_SetString(PyExc_ImportError, "init code.alex.psage.psage.ellcurve.galrep.wrapper");
7053
}
7054
__pyx_L0:;
7055
__Pyx_RefNannyFinishContext();
7056
#if PY_MAJOR_VERSION < 3
7057
return;
7058
#else
7059
return __pyx_m;
7060
#endif
7061
}
7062
7063
/* --- Runtime support code --- */
7064
/* Refnanny */
7065
#if CYTHON_REFNANNY
7066
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
7067
PyObject *m = NULL, *p = NULL;
7068
void *r = NULL;
7069
m = PyImport_ImportModule((char *)modname);
7070
if (!m) goto end;
7071
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
7072
if (!p) goto end;
7073
r = PyLong_AsVoidPtr(p);
7074
end:
7075
Py_XDECREF(p);
7076
Py_XDECREF(m);
7077
return (__Pyx_RefNannyAPIStruct *)r;
7078
}
7079
#endif
7080
7081
/* GetBuiltinName */
7082
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
7083
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
7084
if (unlikely(!result)) {
7085
PyErr_Format(PyExc_NameError,
7086
#if PY_MAJOR_VERSION >= 3
7087
"name '%U' is not defined", name);
7088
#else
7089
"name '%.200s' is not defined", PyString_AS_STRING(name));
7090
#endif
7091
}
7092
return result;
7093
}
7094
7095
/* RaiseDoubleKeywords */
7096
static void __Pyx_RaiseDoubleKeywordsError(
7097
const char* func_name,
7098
PyObject* kw_name)
7099
{
7100
PyErr_Format(PyExc_TypeError,
7101
#if PY_MAJOR_VERSION >= 3
7102
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
7103
#else
7104
"%s() got multiple values for keyword argument '%s'", func_name,
7105
PyString_AsString(kw_name));
7106
#endif
7107
}
7108
7109
/* ParseKeywords */
7110
static int __Pyx_ParseOptionalKeywords(
7111
PyObject *kwds,
7112
PyObject **argnames[],
7113
PyObject *kwds2,
7114
PyObject *values[],
7115
Py_ssize_t num_pos_args,
7116
const char* function_name)
7117
{
7118
PyObject *key = 0, *value = 0;
7119
Py_ssize_t pos = 0;
7120
PyObject*** name;
7121
PyObject*** first_kw_arg = argnames + num_pos_args;
7122
while (PyDict_Next(kwds, &pos, &key, &value)) {
7123
name = first_kw_arg;
7124
while (*name && (**name != key)) name++;
7125
if (*name) {
7126
values[name-argnames] = value;
7127
continue;
7128
}
7129
name = first_kw_arg;
7130
#if PY_MAJOR_VERSION < 3
7131
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
7132
while (*name) {
7133
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
7134
&& _PyString_Eq(**name, key)) {
7135
values[name-argnames] = value;
7136
break;
7137
}
7138
name++;
7139
}
7140
if (*name) continue;
7141
else {
7142
PyObject*** argname = argnames;
7143
while (argname != first_kw_arg) {
7144
if ((**argname == key) || (
7145
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
7146
&& _PyString_Eq(**argname, key))) {
7147
goto arg_passed_twice;
7148
}
7149
argname++;
7150
}
7151
}
7152
} else
7153
#endif
7154
if (likely(PyUnicode_Check(key))) {
7155
while (*name) {
7156
int cmp = (**name == key) ? 0 :
7157
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7158
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
7159
#endif
7160
PyUnicode_Compare(**name, key);
7161
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7162
if (cmp == 0) {
7163
values[name-argnames] = value;
7164
break;
7165
}
7166
name++;
7167
}
7168
if (*name) continue;
7169
else {
7170
PyObject*** argname = argnames;
7171
while (argname != first_kw_arg) {
7172
int cmp = (**argname == key) ? 0 :
7173
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7174
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
7175
#endif
7176
PyUnicode_Compare(**argname, key);
7177
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7178
if (cmp == 0) goto arg_passed_twice;
7179
argname++;
7180
}
7181
}
7182
} else
7183
goto invalid_keyword_type;
7184
if (kwds2) {
7185
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
7186
} else {
7187
goto invalid_keyword;
7188
}
7189
}
7190
return 0;
7191
arg_passed_twice:
7192
__Pyx_RaiseDoubleKeywordsError(function_name, key);
7193
goto bad;
7194
invalid_keyword_type:
7195
PyErr_Format(PyExc_TypeError,
7196
"%.200s() keywords must be strings", function_name);
7197
goto bad;
7198
invalid_keyword:
7199
PyErr_Format(PyExc_TypeError,
7200
#if PY_MAJOR_VERSION < 3
7201
"%.200s() got an unexpected keyword argument '%.200s'",
7202
function_name, PyString_AsString(key));
7203
#else
7204
"%s() got an unexpected keyword argument '%U'",
7205
function_name, key);
7206
#endif
7207
bad:
7208
return -1;
7209
}
7210
7211
/* RaiseArgTupleInvalid */
7212
static void __Pyx_RaiseArgtupleInvalid(
7213
const char* func_name,
7214
int exact,
7215
Py_ssize_t num_min,
7216
Py_ssize_t num_max,
7217
Py_ssize_t num_found)
7218
{
7219
Py_ssize_t num_expected;
7220
const char *more_or_less;
7221
if (num_found < num_min) {
7222
num_expected = num_min;
7223
more_or_less = "at least";
7224
} else {
7225
num_expected = num_max;
7226
more_or_less = "at most";
7227
}
7228
if (exact) {
7229
more_or_less = "exactly";
7230
}
7231
PyErr_Format(PyExc_TypeError,
7232
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
7233
func_name, more_or_less, num_expected,
7234
(num_expected == 1) ? "" : "s", num_found);
7235
}
7236
7237
/* Import */
7238
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
7239
PyObject *empty_list = 0;
7240
PyObject *module = 0;
7241
PyObject *global_dict = 0;
7242
PyObject *empty_dict = 0;
7243
PyObject *list;
7244
#if PY_VERSION_HEX < 0x03030000
7245
PyObject *py_import;
7246
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
7247
if (!py_import)
7248
goto bad;
7249
#endif
7250
if (from_list)
7251
list = from_list;
7252
else {
7253
empty_list = PyList_New(0);
7254
if (!empty_list)
7255
goto bad;
7256
list = empty_list;
7257
}
7258
global_dict = PyModule_GetDict(__pyx_m);
7259
if (!global_dict)
7260
goto bad;
7261
empty_dict = PyDict_New();
7262
if (!empty_dict)
7263
goto bad;
7264
{
7265
#if PY_MAJOR_VERSION >= 3
7266
if (level == -1) {
7267
if (strchr(__Pyx_MODULE_NAME, '.')) {
7268
#if PY_VERSION_HEX < 0x03030000
7269
PyObject *py_level = PyInt_FromLong(1);
7270
if (!py_level)
7271
goto bad;
7272
module = PyObject_CallFunctionObjArgs(py_import,
7273
name, global_dict, empty_dict, list, py_level, NULL);
7274
Py_DECREF(py_level);
7275
#else
7276
module = PyImport_ImportModuleLevelObject(
7277
name, global_dict, empty_dict, list, 1);
7278
#endif
7279
if (!module) {
7280
if (!PyErr_ExceptionMatches(PyExc_ImportError))
7281
goto bad;
7282
PyErr_Clear();
7283
}
7284
}
7285
level = 0;
7286
}
7287
#endif
7288
if (!module) {
7289
#if PY_VERSION_HEX < 0x03030000
7290
PyObject *py_level = PyInt_FromLong(level);
7291
if (!py_level)
7292
goto bad;
7293
module = PyObject_CallFunctionObjArgs(py_import,
7294
name, global_dict, empty_dict, list, py_level, NULL);
7295
Py_DECREF(py_level);
7296
#else
7297
module = PyImport_ImportModuleLevelObject(
7298
name, global_dict, empty_dict, list, level);
7299
#endif
7300
}
7301
}
7302
bad:
7303
#if PY_VERSION_HEX < 0x03030000
7304
Py_XDECREF(py_import);
7305
#endif
7306
Py_XDECREF(empty_list);
7307
Py_XDECREF(empty_dict);
7308
return module;
7309
}
7310
7311
/* GetModuleGlobalName */
7312
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
7313
PyObject *result;
7314
#if !CYTHON_AVOID_BORROWED_REFS
7315
result = PyDict_GetItem(__pyx_d, name);
7316
if (likely(result)) {
7317
Py_INCREF(result);
7318
} else {
7319
#else
7320
result = PyObject_GetItem(__pyx_d, name);
7321
if (!result) {
7322
PyErr_Clear();
7323
#endif
7324
result = __Pyx_GetBuiltinName(name);
7325
}
7326
return result;
7327
}
7328
7329
/* PyCFunctionFastCall */
7330
#if CYTHON_FAST_PYCCALL
7331
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
7332
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
7333
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
7334
PyObject *self = PyCFunction_GET_SELF(func);
7335
assert(PyCFunction_Check(func));
7336
assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
7337
assert(nargs >= 0);
7338
assert(nargs == 0 || args != NULL);
7339
/* _PyCFunction_FastCallDict() must not be called with an exception set,
7340
because it may clear it (directly or indirectly) and so the
7341
caller loses its exception */
7342
assert(!PyErr_Occurred());
7343
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
7344
}
7345
#endif // CYTHON_FAST_PYCCALL
7346
7347
/* PyFunctionFastCall */
7348
#if CYTHON_FAST_PYCALL
7349
#include "frameobject.h"
7350
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
7351
PyObject *globals) {
7352
PyFrameObject *f;
7353
PyThreadState *tstate = PyThreadState_GET();
7354
PyObject **fastlocals;
7355
Py_ssize_t i;
7356
PyObject *result;
7357
assert(globals != NULL);
7358
/* XXX Perhaps we should create a specialized
7359
PyFrame_New() that doesn't take locals, but does
7360
take builtins without sanity checking them.
7361
*/
7362
assert(tstate != NULL);
7363
f = PyFrame_New(tstate, co, globals, NULL);
7364
if (f == NULL) {
7365
return NULL;
7366
}
7367
fastlocals = f->f_localsplus;
7368
for (i = 0; i < na; i++) {
7369
Py_INCREF(*args);
7370
fastlocals[i] = *args++;
7371
}
7372
result = PyEval_EvalFrameEx(f,0);
7373
++tstate->recursion_depth;
7374
Py_DECREF(f);
7375
--tstate->recursion_depth;
7376
return result;
7377
}
7378
#if 1 || PY_VERSION_HEX < 0x030600B1
7379
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
7380
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
7381
PyObject *globals = PyFunction_GET_GLOBALS(func);
7382
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
7383
PyObject *closure;
7384
#if PY_MAJOR_VERSION >= 3
7385
PyObject *kwdefs;
7386
#endif
7387
PyObject *kwtuple, **k;
7388
PyObject **d;
7389
Py_ssize_t nd;
7390
Py_ssize_t nk;
7391
PyObject *result;
7392
assert(kwargs == NULL || PyDict_Check(kwargs));
7393
nk = kwargs ? PyDict_Size(kwargs) : 0;
7394
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
7395
return NULL;
7396
}
7397
if (
7398
#if PY_MAJOR_VERSION >= 3
7399
co->co_kwonlyargcount == 0 &&
7400
#endif
7401
likely(kwargs == NULL || nk == 0) &&
7402
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
7403
if (argdefs == NULL && co->co_argcount == nargs) {
7404
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
7405
goto done;
7406
}
7407
else if (nargs == 0 && argdefs != NULL
7408
&& co->co_argcount == Py_SIZE(argdefs)) {
7409
/* function called with no arguments, but all parameters have
7410
a default value: use default values as arguments .*/
7411
args = &PyTuple_GET_ITEM(argdefs, 0);
7412
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
7413
goto done;
7414
}
7415
}
7416
if (kwargs != NULL) {
7417
Py_ssize_t pos, i;
7418
kwtuple = PyTuple_New(2 * nk);
7419
if (kwtuple == NULL) {
7420
result = NULL;
7421
goto done;
7422
}
7423
k = &PyTuple_GET_ITEM(kwtuple, 0);
7424
pos = i = 0;
7425
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
7426
Py_INCREF(k[i]);
7427
Py_INCREF(k[i+1]);
7428
i += 2;
7429
}
7430
nk = i / 2;
7431
}
7432
else {
7433
kwtuple = NULL;
7434
k = NULL;
7435
}
7436
closure = PyFunction_GET_CLOSURE(func);
7437
#if PY_MAJOR_VERSION >= 3
7438
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
7439
#endif
7440
if (argdefs != NULL) {
7441
d = &PyTuple_GET_ITEM(argdefs, 0);
7442
nd = Py_SIZE(argdefs);
7443
}
7444
else {
7445
d = NULL;
7446
nd = 0;
7447
}
7448
#if PY_MAJOR_VERSION >= 3
7449
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
7450
args, nargs,
7451
k, (int)nk,
7452
d, (int)nd, kwdefs, closure);
7453
#else
7454
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
7455
args, nargs,
7456
k, (int)nk,
7457
d, (int)nd, closure);
7458
#endif
7459
Py_XDECREF(kwtuple);
7460
done:
7461
Py_LeaveRecursiveCall();
7462
return result;
7463
}
7464
#endif // CPython < 3.6
7465
#endif // CYTHON_FAST_PYCALL
7466
7467
/* PyObjectCall */
7468
#if CYTHON_COMPILING_IN_CPYTHON
7469
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
7470
PyObject *result;
7471
ternaryfunc call = func->ob_type->tp_call;
7472
if (unlikely(!call))
7473
return PyObject_Call(func, arg, kw);
7474
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7475
return NULL;
7476
result = (*call)(func, arg, kw);
7477
Py_LeaveRecursiveCall();
7478
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7479
PyErr_SetString(
7480
PyExc_SystemError,
7481
"NULL result without error in PyObject_Call");
7482
}
7483
return result;
7484
}
7485
#endif
7486
7487
/* PyObjectCallMethO */
7488
#if CYTHON_COMPILING_IN_CPYTHON
7489
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
7490
PyObject *self, *result;
7491
PyCFunction cfunc;
7492
cfunc = PyCFunction_GET_FUNCTION(func);
7493
self = PyCFunction_GET_SELF(func);
7494
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7495
return NULL;
7496
result = cfunc(self, arg);
7497
Py_LeaveRecursiveCall();
7498
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7499
PyErr_SetString(
7500
PyExc_SystemError,
7501
"NULL result without error in PyObject_Call");
7502
}
7503
return result;
7504
}
7505
#endif
7506
7507
/* PyObjectCallOneArg */
7508
#if CYTHON_COMPILING_IN_CPYTHON
7509
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7510
PyObject *result;
7511
PyObject *args = PyTuple_New(1);
7512
if (unlikely(!args)) return NULL;
7513
Py_INCREF(arg);
7514
PyTuple_SET_ITEM(args, 0, arg);
7515
result = __Pyx_PyObject_Call(func, args, NULL);
7516
Py_DECREF(args);
7517
return result;
7518
}
7519
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7520
#if CYTHON_FAST_PYCALL
7521
if (PyFunction_Check(func)) {
7522
return __Pyx_PyFunction_FastCall(func, &arg, 1);
7523
}
7524
#endif
7525
#ifdef __Pyx_CyFunction_USED
7526
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
7527
#else
7528
if (likely(PyCFunction_Check(func))) {
7529
#endif
7530
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
7531
return __Pyx_PyObject_CallMethO(func, arg);
7532
#if CYTHON_FAST_PYCCALL
7533
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
7534
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
7535
#endif
7536
}
7537
}
7538
return __Pyx__PyObject_CallOneArg(func, arg);
7539
}
7540
#else
7541
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
7542
PyObject *result;
7543
PyObject *args = PyTuple_Pack(1, arg);
7544
if (unlikely(!args)) return NULL;
7545
result = __Pyx_PyObject_Call(func, args, NULL);
7546
Py_DECREF(args);
7547
return result;
7548
}
7549
#endif
7550
7551
/* PyErrFetchRestore */
7552
#if CYTHON_FAST_THREAD_STATE
7553
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
7554
PyObject *tmp_type, *tmp_value, *tmp_tb;
7555
tmp_type = tstate->curexc_type;
7556
tmp_value = tstate->curexc_value;
7557
tmp_tb = tstate->curexc_traceback;
7558
tstate->curexc_type = type;
7559
tstate->curexc_value = value;
7560
tstate->curexc_traceback = tb;
7561
Py_XDECREF(tmp_type);
7562
Py_XDECREF(tmp_value);
7563
Py_XDECREF(tmp_tb);
7564
}
7565
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
7566
*type = tstate->curexc_type;
7567
*value = tstate->curexc_value;
7568
*tb = tstate->curexc_traceback;
7569
tstate->curexc_type = 0;
7570
tstate->curexc_value = 0;
7571
tstate->curexc_traceback = 0;
7572
}
7573
#endif
7574
7575
/* RaiseException */
7576
#if PY_MAJOR_VERSION < 3
7577
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
7578
CYTHON_UNUSED PyObject *cause) {
7579
__Pyx_PyThreadState_declare
7580
Py_XINCREF(type);
7581
if (!value || value == Py_None)
7582
value = NULL;
7583
else
7584
Py_INCREF(value);
7585
if (!tb || tb == Py_None)
7586
tb = NULL;
7587
else {
7588
Py_INCREF(tb);
7589
if (!PyTraceBack_Check(tb)) {
7590
PyErr_SetString(PyExc_TypeError,
7591
"raise: arg 3 must be a traceback or None");
7592
goto raise_error;
7593
}
7594
}
7595
if (PyType_Check(type)) {
7596
#if CYTHON_COMPILING_IN_PYPY
7597
if (!value) {
7598
Py_INCREF(Py_None);
7599
value = Py_None;
7600
}
7601
#endif
7602
PyErr_NormalizeException(&type, &value, &tb);
7603
} else {
7604
if (value) {
7605
PyErr_SetString(PyExc_TypeError,
7606
"instance exception may not have a separate value");
7607
goto raise_error;
7608
}
7609
value = type;
7610
type = (PyObject*) Py_TYPE(type);
7611
Py_INCREF(type);
7612
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
7613
PyErr_SetString(PyExc_TypeError,
7614
"raise: exception class must be a subclass of BaseException");
7615
goto raise_error;
7616
}
7617
}
7618
__Pyx_PyThreadState_assign
7619
__Pyx_ErrRestore(type, value, tb);
7620
return;
7621
raise_error:
7622
Py_XDECREF(value);
7623
Py_XDECREF(type);
7624
Py_XDECREF(tb);
7625
return;
7626
}
7627
#else
7628
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
7629
PyObject* owned_instance = NULL;
7630
if (tb == Py_None) {
7631
tb = 0;
7632
} else if (tb && !PyTraceBack_Check(tb)) {
7633
PyErr_SetString(PyExc_TypeError,
7634
"raise: arg 3 must be a traceback or None");
7635
goto bad;
7636
}
7637
if (value == Py_None)
7638
value = 0;
7639
if (PyExceptionInstance_Check(type)) {
7640
if (value) {
7641
PyErr_SetString(PyExc_TypeError,
7642
"instance exception may not have a separate value");
7643
goto bad;
7644
}
7645
value = type;
7646
type = (PyObject*) Py_TYPE(value);
7647
} else if (PyExceptionClass_Check(type)) {
7648
PyObject *instance_class = NULL;
7649
if (value && PyExceptionInstance_Check(value)) {
7650
instance_class = (PyObject*) Py_TYPE(value);
7651
if (instance_class != type) {
7652
int is_subclass = PyObject_IsSubclass(instance_class, type);
7653
if (!is_subclass) {
7654
instance_class = NULL;
7655
} else if (unlikely(is_subclass == -1)) {
7656
goto bad;
7657
} else {
7658
type = instance_class;
7659
}
7660
}
7661
}
7662
if (!instance_class) {
7663
PyObject *args;
7664
if (!value)
7665
args = PyTuple_New(0);
7666
else if (PyTuple_Check(value)) {
7667
Py_INCREF(value);
7668
args = value;
7669
} else
7670
args = PyTuple_Pack(1, value);
7671
if (!args)
7672
goto bad;
7673
owned_instance = PyObject_Call(type, args, NULL);
7674
Py_DECREF(args);
7675
if (!owned_instance)
7676
goto bad;
7677
value = owned_instance;
7678
if (!PyExceptionInstance_Check(value)) {
7679
PyErr_Format(PyExc_TypeError,
7680
"calling %R should have returned an instance of "
7681
"BaseException, not %R",
7682
type, Py_TYPE(value));
7683
goto bad;
7684
}
7685
}
7686
} else {
7687
PyErr_SetString(PyExc_TypeError,
7688
"raise: exception class must be a subclass of BaseException");
7689
goto bad;
7690
}
7691
#if PY_VERSION_HEX >= 0x03030000
7692
if (cause) {
7693
#else
7694
if (cause && cause != Py_None) {
7695
#endif
7696
PyObject *fixed_cause;
7697
if (cause == Py_None) {
7698
fixed_cause = NULL;
7699
} else if (PyExceptionClass_Check(cause)) {
7700
fixed_cause = PyObject_CallObject(cause, NULL);
7701
if (fixed_cause == NULL)
7702
goto bad;
7703
} else if (PyExceptionInstance_Check(cause)) {
7704
fixed_cause = cause;
7705
Py_INCREF(fixed_cause);
7706
} else {
7707
PyErr_SetString(PyExc_TypeError,
7708
"exception causes must derive from "
7709
"BaseException");
7710
goto bad;
7711
}
7712
PyException_SetCause(value, fixed_cause);
7713
}
7714
PyErr_SetObject(type, value);
7715
if (tb) {
7716
#if CYTHON_COMPILING_IN_PYPY
7717
PyObject *tmp_type, *tmp_value, *tmp_tb;
7718
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
7719
Py_INCREF(tb);
7720
PyErr_Restore(tmp_type, tmp_value, tb);
7721
Py_XDECREF(tmp_tb);
7722
#else
7723
PyThreadState *tstate = PyThreadState_GET();
7724
PyObject* tmp_tb = tstate->curexc_traceback;
7725
if (tb != tmp_tb) {
7726
Py_INCREF(tb);
7727
tstate->curexc_traceback = tb;
7728
Py_XDECREF(tmp_tb);
7729
}
7730
#endif
7731
}
7732
bad:
7733
Py_XDECREF(owned_instance);
7734
return;
7735
}
7736
#endif
7737
7738
/* ArgTypeTest */
7739
static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
7740
PyErr_Format(PyExc_TypeError,
7741
"Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
7742
name, type->tp_name, Py_TYPE(obj)->tp_name);
7743
}
7744
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
7745
const char *name, int exact)
7746
{
7747
if (unlikely(!type)) {
7748
PyErr_SetString(PyExc_SystemError, "Missing type object");
7749
return 0;
7750
}
7751
if (none_allowed && obj == Py_None) return 1;
7752
else if (exact) {
7753
if (likely(Py_TYPE(obj) == type)) return 1;
7754
#if PY_MAJOR_VERSION == 2
7755
else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
7756
#endif
7757
}
7758
else {
7759
if (likely(PyObject_TypeCheck(obj, type))) return 1;
7760
}
7761
__Pyx_RaiseArgumentTypeInvalid(name, obj, type);
7762
return 0;
7763
}
7764
7765
/* GetItemInt */
7766
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
7767
PyObject *r;
7768
if (!j) return NULL;
7769
r = PyObject_GetItem(o, j);
7770
Py_DECREF(j);
7771
return r;
7772
}
7773
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
7774
CYTHON_NCP_UNUSED int wraparound,
7775
CYTHON_NCP_UNUSED int boundscheck) {
7776
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7777
if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
7778
if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
7779
PyObject *r = PyList_GET_ITEM(o, i);
7780
Py_INCREF(r);
7781
return r;
7782
}
7783
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
7784
#else
7785
return PySequence_GetItem(o, i);
7786
#endif
7787
}
7788
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
7789
CYTHON_NCP_UNUSED int wraparound,
7790
CYTHON_NCP_UNUSED int boundscheck) {
7791
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7792
if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
7793
if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
7794
PyObject *r = PyTuple_GET_ITEM(o, i);
7795
Py_INCREF(r);
7796
return r;
7797
}
7798
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
7799
#else
7800
return PySequence_GetItem(o, i);
7801
#endif
7802
}
7803
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
7804
CYTHON_NCP_UNUSED int wraparound,
7805
CYTHON_NCP_UNUSED int boundscheck) {
7806
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
7807
if (is_list || PyList_CheckExact(o)) {
7808
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
7809
if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
7810
PyObject *r = PyList_GET_ITEM(o, n);
7811
Py_INCREF(r);
7812
return r;
7813
}
7814
}
7815
else if (PyTuple_CheckExact(o)) {
7816
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
7817
if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
7818
PyObject *r = PyTuple_GET_ITEM(o, n);
7819
Py_INCREF(r);
7820
return r;
7821
}
7822
} else {
7823
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
7824
if (likely(m && m->sq_item)) {
7825
if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
7826
Py_ssize_t l = m->sq_length(o);
7827
if (likely(l >= 0)) {
7828
i += l;
7829
} else {
7830
if (!PyErr_ExceptionMatches(PyExc_OverflowError))
7831
return NULL;
7832
PyErr_Clear();
7833
}
7834
}
7835
return m->sq_item(o, i);
7836
}
7837
}
7838
#else
7839
if (is_list || PySequence_Check(o)) {
7840
return PySequence_GetItem(o, i);
7841
}
7842
#endif
7843
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
7844
}
7845
7846
/* SaveResetException */
7847
#if CYTHON_FAST_THREAD_STATE
7848
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
7849
*type = tstate->exc_type;
7850
*value = tstate->exc_value;
7851
*tb = tstate->exc_traceback;
7852
Py_XINCREF(*type);
7853
Py_XINCREF(*value);
7854
Py_XINCREF(*tb);
7855
}
7856
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
7857
PyObject *tmp_type, *tmp_value, *tmp_tb;
7858
tmp_type = tstate->exc_type;
7859
tmp_value = tstate->exc_value;
7860
tmp_tb = tstate->exc_traceback;
7861
tstate->exc_type = type;
7862
tstate->exc_value = value;
7863
tstate->exc_traceback = tb;
7864
Py_XDECREF(tmp_type);
7865
Py_XDECREF(tmp_value);
7866
Py_XDECREF(tmp_tb);
7867
}
7868
#endif
7869
7870
/* PyObjectCallNoArg */
7871
#if CYTHON_COMPILING_IN_CPYTHON
7872
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
7873
#if CYTHON_FAST_PYCALL
7874
if (PyFunction_Check(func)) {
7875
return __Pyx_PyFunction_FastCall(func, NULL, 0);
7876
}
7877
#endif
7878
#ifdef __Pyx_CyFunction_USED
7879
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
7880
#else
7881
if (likely(PyCFunction_Check(func))) {
7882
#endif
7883
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
7884
return __Pyx_PyObject_CallMethO(func, NULL);
7885
}
7886
}
7887
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
7888
}
7889
#endif
7890
7891
/* PyErrExceptionMatches */
7892
#if CYTHON_FAST_THREAD_STATE
7893
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
7894
PyObject *exc_type = tstate->curexc_type;
7895
if (exc_type == err) return 1;
7896
if (unlikely(!exc_type)) return 0;
7897
return PyErr_GivenExceptionMatches(exc_type, err);
7898
}
7899
#endif
7900
7901
/* GetException */
7902
#if CYTHON_FAST_THREAD_STATE
7903
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
7904
#else
7905
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
7906
#endif
7907
PyObject *local_type, *local_value, *local_tb;
7908
#if CYTHON_FAST_THREAD_STATE
7909
PyObject *tmp_type, *tmp_value, *tmp_tb;
7910
local_type = tstate->curexc_type;
7911
local_value = tstate->curexc_value;
7912
local_tb = tstate->curexc_traceback;
7913
tstate->curexc_type = 0;
7914
tstate->curexc_value = 0;
7915
tstate->curexc_traceback = 0;
7916
#else
7917
PyErr_Fetch(&local_type, &local_value, &local_tb);
7918
#endif
7919
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
7920
#if CYTHON_FAST_THREAD_STATE
7921
if (unlikely(tstate->curexc_type))
7922
#else
7923
if (unlikely(PyErr_Occurred()))
7924
#endif
7925
goto bad;
7926
#if PY_MAJOR_VERSION >= 3
7927
if (local_tb) {
7928
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
7929
goto bad;
7930
}
7931
#endif
7932
Py_XINCREF(local_tb);
7933
Py_XINCREF(local_type);
7934
Py_XINCREF(local_value);
7935
*type = local_type;
7936
*value = local_value;
7937
*tb = local_tb;
7938
#if CYTHON_FAST_THREAD_STATE
7939
tmp_type = tstate->exc_type;
7940
tmp_value = tstate->exc_value;
7941
tmp_tb = tstate->exc_traceback;
7942
tstate->exc_type = local_type;
7943
tstate->exc_value = local_value;
7944
tstate->exc_traceback = local_tb;
7945
Py_XDECREF(tmp_type);
7946
Py_XDECREF(tmp_value);
7947
Py_XDECREF(tmp_tb);
7948
#else
7949
PyErr_SetExcInfo(local_type, local_value, local_tb);
7950
#endif
7951
return 0;
7952
bad:
7953
*type = 0;
7954
*value = 0;
7955
*tb = 0;
7956
Py_XDECREF(local_type);
7957
Py_XDECREF(local_value);
7958
Py_XDECREF(local_tb);
7959
return -1;
7960
}
7961
7962
/* FetchCommonType */
7963
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
7964
PyObject* fake_module;
7965
PyTypeObject* cached_type = NULL;
7966
fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
7967
if (!fake_module) return NULL;
7968
Py_INCREF(fake_module);
7969
cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
7970
if (cached_type) {
7971
if (!PyType_Check((PyObject*)cached_type)) {
7972
PyErr_Format(PyExc_TypeError,
7973
"Shared Cython type %.200s is not a type object",
7974
type->tp_name);
7975
goto bad;
7976
}
7977
if (cached_type->tp_basicsize != type->tp_basicsize) {
7978
PyErr_Format(PyExc_TypeError,
7979
"Shared Cython type %.200s has the wrong size, try recompiling",
7980
type->tp_name);
7981
goto bad;
7982
}
7983
} else {
7984
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
7985
PyErr_Clear();
7986
if (PyType_Ready(type) < 0) goto bad;
7987
if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
7988
goto bad;
7989
Py_INCREF(type);
7990
cached_type = type;
7991
}
7992
done:
7993
Py_DECREF(fake_module);
7994
return cached_type;
7995
bad:
7996
Py_XDECREF(cached_type);
7997
cached_type = NULL;
7998
goto done;
7999
}
8000
8001
/* CythonFunction */
8002
static PyObject *
8003
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
8004
{
8005
if (unlikely(op->func_doc == NULL)) {
8006
if (op->func.m_ml->ml_doc) {
8007
#if PY_MAJOR_VERSION >= 3
8008
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
8009
#else
8010
op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
8011
#endif
8012
if (unlikely(op->func_doc == NULL))
8013
return NULL;
8014
} else {
8015
Py_INCREF(Py_None);
8016
return Py_None;
8017
}
8018
}
8019
Py_INCREF(op->func_doc);
8020
return op->func_doc;
8021
}
8022
static int
8023
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
8024
{
8025
PyObject *tmp = op->func_doc;
8026
if (value == NULL) {
8027
value = Py_None;
8028
}
8029
Py_INCREF(value);
8030
op->func_doc = value;
8031
Py_XDECREF(tmp);
8032
return 0;
8033
}
8034
static PyObject *
8035
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
8036
{
8037
if (unlikely(op->func_name == NULL)) {
8038
#if PY_MAJOR_VERSION >= 3
8039
op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
8040
#else
8041
op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
8042
#endif
8043
if (unlikely(op->func_name == NULL))
8044
return NULL;
8045
}
8046
Py_INCREF(op->func_name);
8047
return op->func_name;
8048
}
8049
static int
8050
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
8051
{
8052
PyObject *tmp;
8053
#if PY_MAJOR_VERSION >= 3
8054
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
8055
#else
8056
if (unlikely(value == NULL || !PyString_Check(value))) {
8057
#endif
8058
PyErr_SetString(PyExc_TypeError,
8059
"__name__ must be set to a string object");
8060
return -1;
8061
}
8062
tmp = op->func_name;
8063
Py_INCREF(value);
8064
op->func_name = value;
8065
Py_XDECREF(tmp);
8066
return 0;
8067
}
8068
static PyObject *
8069
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
8070
{
8071
Py_INCREF(op->func_qualname);
8072
return op->func_qualname;
8073
}
8074
static int
8075
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
8076
{
8077
PyObject *tmp;
8078
#if PY_MAJOR_VERSION >= 3
8079
if (unlikely(value == NULL || !PyUnicode_Check(value))) {
8080
#else
8081
if (unlikely(value == NULL || !PyString_Check(value))) {
8082
#endif
8083
PyErr_SetString(PyExc_TypeError,
8084
"__qualname__ must be set to a string object");
8085
return -1;
8086
}
8087
tmp = op->func_qualname;
8088
Py_INCREF(value);
8089
op->func_qualname = value;
8090
Py_XDECREF(tmp);
8091
return 0;
8092
}
8093
static PyObject *
8094
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
8095
{
8096
PyObject *self;
8097
self = m->func_closure;
8098
if (self == NULL)
8099
self = Py_None;
8100
Py_INCREF(self);
8101
return self;
8102
}
8103
static PyObject *
8104
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
8105
{
8106
if (unlikely(op->func_dict == NULL)) {
8107
op->func_dict = PyDict_New();
8108
if (unlikely(op->func_dict == NULL))
8109
return NULL;
8110
}
8111
Py_INCREF(op->func_dict);
8112
return op->func_dict;
8113
}
8114
static int
8115
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
8116
{
8117
PyObject *tmp;
8118
if (unlikely(value == NULL)) {
8119
PyErr_SetString(PyExc_TypeError,
8120
"function's dictionary may not be deleted");
8121
return -1;
8122
}
8123
if (unlikely(!PyDict_Check(value))) {
8124
PyErr_SetString(PyExc_TypeError,
8125
"setting function's dictionary to a non-dict");
8126
return -1;
8127
}
8128
tmp = op->func_dict;
8129
Py_INCREF(value);
8130
op->func_dict = value;
8131
Py_XDECREF(tmp);
8132
return 0;
8133
}
8134
static PyObject *
8135
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
8136
{
8137
Py_INCREF(op->func_globals);
8138
return op->func_globals;
8139
}
8140
static PyObject *
8141
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
8142
{
8143
Py_INCREF(Py_None);
8144
return Py_None;
8145
}
8146
static PyObject *
8147
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
8148
{
8149
PyObject* result = (op->func_code) ? op->func_code : Py_None;
8150
Py_INCREF(result);
8151
return result;
8152
}
8153
static int
8154
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
8155
int result = 0;
8156
PyObject *res = op->defaults_getter((PyObject *) op);
8157
if (unlikely(!res))
8158
return -1;
8159
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8160
op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
8161
Py_INCREF(op->defaults_tuple);
8162
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
8163
Py_INCREF(op->defaults_kwdict);
8164
#else
8165
op->defaults_tuple = PySequence_ITEM(res, 0);
8166
if (unlikely(!op->defaults_tuple)) result = -1;
8167
else {
8168
op->defaults_kwdict = PySequence_ITEM(res, 1);
8169
if (unlikely(!op->defaults_kwdict)) result = -1;
8170
}
8171
#endif
8172
Py_DECREF(res);
8173
return result;
8174
}
8175
static int
8176
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
8177
PyObject* tmp;
8178
if (!value) {
8179
value = Py_None;
8180
} else if (value != Py_None && !PyTuple_Check(value)) {
8181
PyErr_SetString(PyExc_TypeError,
8182
"__defaults__ must be set to a tuple object");
8183
return -1;
8184
}
8185
Py_INCREF(value);
8186
tmp = op->defaults_tuple;
8187
op->defaults_tuple = value;
8188
Py_XDECREF(tmp);
8189
return 0;
8190
}
8191
static PyObject *
8192
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
8193
PyObject* result = op->defaults_tuple;
8194
if (unlikely(!result)) {
8195
if (op->defaults_getter) {
8196
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
8197
result = op->defaults_tuple;
8198
} else {
8199
result = Py_None;
8200
}
8201
}
8202
Py_INCREF(result);
8203
return result;
8204
}
8205
static int
8206
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
8207
PyObject* tmp;
8208
if (!value) {
8209
value = Py_None;
8210
} else if (value != Py_None && !PyDict_Check(value)) {
8211
PyErr_SetString(PyExc_TypeError,
8212
"__kwdefaults__ must be set to a dict object");
8213
return -1;
8214
}
8215
Py_INCREF(value);
8216
tmp = op->defaults_kwdict;
8217
op->defaults_kwdict = value;
8218
Py_XDECREF(tmp);
8219
return 0;
8220
}
8221
static PyObject *
8222
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
8223
PyObject* result = op->defaults_kwdict;
8224
if (unlikely(!result)) {
8225
if (op->defaults_getter) {
8226
if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
8227
result = op->defaults_kwdict;
8228
} else {
8229
result = Py_None;
8230
}
8231
}
8232
Py_INCREF(result);
8233
return result;
8234
}
8235
static int
8236
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
8237
PyObject* tmp;
8238
if (!value || value == Py_None) {
8239
value = NULL;
8240
} else if (!PyDict_Check(value)) {
8241
PyErr_SetString(PyExc_TypeError,
8242
"__annotations__ must be set to a dict object");
8243
return -1;
8244
}
8245
Py_XINCREF(value);
8246
tmp = op->func_annotations;
8247
op->func_annotations = value;
8248
Py_XDECREF(tmp);
8249
return 0;
8250
}
8251
static PyObject *
8252
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
8253
PyObject* result = op->func_annotations;
8254
if (unlikely(!result)) {
8255
result = PyDict_New();
8256
if (unlikely(!result)) return NULL;
8257
op->func_annotations = result;
8258
}
8259
Py_INCREF(result);
8260
return result;
8261
}
8262
static PyGetSetDef __pyx_CyFunction_getsets[] = {
8263
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
8264
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
8265
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
8266
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
8267
{(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
8268
{(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
8269
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
8270
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
8271
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
8272
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
8273
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
8274
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
8275
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
8276
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
8277
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
8278
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
8279
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
8280
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
8281
{0, 0, 0, 0, 0}
8282
};
8283
static PyMemberDef __pyx_CyFunction_members[] = {
8284
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
8285
{0, 0, 0, 0, 0}
8286
};
8287
static PyObject *
8288
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
8289
{
8290
#if PY_MAJOR_VERSION >= 3
8291
return PyUnicode_FromString(m->func.m_ml->ml_name);
8292
#else
8293
return PyString_FromString(m->func.m_ml->ml_name);
8294
#endif
8295
}
8296
static PyMethodDef __pyx_CyFunction_methods[] = {
8297
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
8298
{0, 0, 0, 0}
8299
};
8300
#if PY_VERSION_HEX < 0x030500A0
8301
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
8302
#else
8303
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
8304
#endif
8305
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
8306
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
8307
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
8308
if (op == NULL)
8309
return NULL;
8310
op->flags = flags;
8311
__Pyx_CyFunction_weakreflist(op) = NULL;
8312
op->func.m_ml = ml;
8313
op->func.m_self = (PyObject *) op;
8314
Py_XINCREF(closure);
8315
op->func_closure = closure;
8316
Py_XINCREF(module);
8317
op->func.m_module = module;
8318
op->func_dict = NULL;
8319
op->func_name = NULL;
8320
Py_INCREF(qualname);
8321
op->func_qualname = qualname;
8322
op->func_doc = NULL;
8323
op->func_classobj = NULL;
8324
op->func_globals = globals;
8325
Py_INCREF(op->func_globals);
8326
Py_XINCREF(code);
8327
op->func_code = code;
8328
op->defaults_pyobjects = 0;
8329
op->defaults = NULL;
8330
op->defaults_tuple = NULL;
8331
op->defaults_kwdict = NULL;
8332
op->defaults_getter = NULL;
8333
op->func_annotations = NULL;
8334
PyObject_GC_Track(op);
8335
return (PyObject *) op;
8336
}
8337
static int
8338
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
8339
{
8340
Py_CLEAR(m->func_closure);
8341
Py_CLEAR(m->func.m_module);
8342
Py_CLEAR(m->func_dict);
8343
Py_CLEAR(m->func_name);
8344
Py_CLEAR(m->func_qualname);
8345
Py_CLEAR(m->func_doc);
8346
Py_CLEAR(m->func_globals);
8347
Py_CLEAR(m->func_code);
8348
Py_CLEAR(m->func_classobj);
8349
Py_CLEAR(m->defaults_tuple);
8350
Py_CLEAR(m->defaults_kwdict);
8351
Py_CLEAR(m->func_annotations);
8352
if (m->defaults) {
8353
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
8354
int i;
8355
for (i = 0; i < m->defaults_pyobjects; i++)
8356
Py_XDECREF(pydefaults[i]);
8357
PyObject_Free(m->defaults);
8358
m->defaults = NULL;
8359
}
8360
return 0;
8361
}
8362
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
8363
{
8364
PyObject_GC_UnTrack(m);
8365
if (__Pyx_CyFunction_weakreflist(m) != NULL)
8366
PyObject_ClearWeakRefs((PyObject *) m);
8367
__Pyx_CyFunction_clear(m);
8368
PyObject_GC_Del(m);
8369
}
8370
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
8371
{
8372
Py_VISIT(m->func_closure);
8373
Py_VISIT(m->func.m_module);
8374
Py_VISIT(m->func_dict);
8375
Py_VISIT(m->func_name);
8376
Py_VISIT(m->func_qualname);
8377
Py_VISIT(m->func_doc);
8378
Py_VISIT(m->func_globals);
8379
Py_VISIT(m->func_code);
8380
Py_VISIT(m->func_classobj);
8381
Py_VISIT(m->defaults_tuple);
8382
Py_VISIT(m->defaults_kwdict);
8383
if (m->defaults) {
8384
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
8385
int i;
8386
for (i = 0; i < m->defaults_pyobjects; i++)
8387
Py_VISIT(pydefaults[i]);
8388
}
8389
return 0;
8390
}
8391
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
8392
{
8393
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8394
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
8395
Py_INCREF(func);
8396
return func;
8397
}
8398
if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
8399
if (type == NULL)
8400
type = (PyObject *)(Py_TYPE(obj));
8401
return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
8402
}
8403
if (obj == Py_None)
8404
obj = NULL;
8405
return __Pyx_PyMethod_New(func, obj, type);
8406
}
8407
static PyObject*
8408
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
8409
{
8410
#if PY_MAJOR_VERSION >= 3
8411
return PyUnicode_FromFormat("<cyfunction %U at %p>",
8412
op->func_qualname, (void *)op);
8413
#else
8414
return PyString_FromFormat("<cyfunction %s at %p>",
8415
PyString_AsString(op->func_qualname), (void *)op);
8416
#endif
8417
}
8418
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
8419
PyCFunctionObject* f = (PyCFunctionObject*)func;
8420
PyCFunction meth = f->m_ml->ml_meth;
8421
Py_ssize_t size;
8422
switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
8423
case METH_VARARGS:
8424
if (likely(kw == NULL || PyDict_Size(kw) == 0))
8425
return (*meth)(self, arg);
8426
break;
8427
case METH_VARARGS | METH_KEYWORDS:
8428
return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
8429
case METH_NOARGS:
8430
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
8431
size = PyTuple_GET_SIZE(arg);
8432
if (likely(size == 0))
8433
return (*meth)(self, NULL);
8434
PyErr_Format(PyExc_TypeError,
8435
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
8436
f->m_ml->ml_name, size);
8437
return NULL;
8438
}
8439
break;
8440
case METH_O:
8441
if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
8442
size = PyTuple_GET_SIZE(arg);
8443
if (likely(size == 1)) {
8444
PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
8445
if (unlikely(!arg0)) return NULL;
8446
result = (*meth)(self, arg0);
8447
Py_DECREF(arg0);
8448
return result;
8449
}
8450
PyErr_Format(PyExc_TypeError,
8451
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
8452
f->m_ml->ml_name, size);
8453
return NULL;
8454
}
8455
break;
8456
default:
8457
PyErr_SetString(PyExc_SystemError, "Bad call flags in "
8458
"__Pyx_CyFunction_Call. METH_OLDARGS is no "
8459
"longer supported!");
8460
return NULL;
8461
}
8462
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
8463
f->m_ml->ml_name);
8464
return NULL;
8465
}
8466
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
8467
return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
8468
}
8469
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
8470
PyObject *result;
8471
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
8472
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
8473
Py_ssize_t argc;
8474
PyObject *new_args;
8475
PyObject *self;
8476
argc = PyTuple_GET_SIZE(args);
8477
new_args = PyTuple_GetSlice(args, 1, argc);
8478
if (unlikely(!new_args))
8479
return NULL;
8480
self = PyTuple_GetItem(args, 0);
8481
if (unlikely(!self)) {
8482
Py_DECREF(new_args);
8483
return NULL;
8484
}
8485
result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
8486
Py_DECREF(new_args);
8487
} else {
8488
result = __Pyx_CyFunction_Call(func, args, kw);
8489
}
8490
return result;
8491
}
8492
static PyTypeObject __pyx_CyFunctionType_type = {
8493
PyVarObject_HEAD_INIT(0, 0)
8494
"cython_function_or_method",
8495
sizeof(__pyx_CyFunctionObject),
8496
0,
8497
(destructor) __Pyx_CyFunction_dealloc,
8498
0,
8499
0,
8500
0,
8501
#if PY_MAJOR_VERSION < 3
8502
0,
8503
#else
8504
0,
8505
#endif
8506
(reprfunc) __Pyx_CyFunction_repr,
8507
0,
8508
0,
8509
0,
8510
0,
8511
__Pyx_CyFunction_CallAsMethod,
8512
0,
8513
0,
8514
0,
8515
0,
8516
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
8517
0,
8518
(traverseproc) __Pyx_CyFunction_traverse,
8519
(inquiry) __Pyx_CyFunction_clear,
8520
0,
8521
#if PY_VERSION_HEX < 0x030500A0
8522
offsetof(__pyx_CyFunctionObject, func_weakreflist),
8523
#else
8524
offsetof(PyCFunctionObject, m_weakreflist),
8525
#endif
8526
0,
8527
0,
8528
__pyx_CyFunction_methods,
8529
__pyx_CyFunction_members,
8530
__pyx_CyFunction_getsets,
8531
0,
8532
0,
8533
__Pyx_CyFunction_descr_get,
8534
0,
8535
offsetof(__pyx_CyFunctionObject, func_dict),
8536
0,
8537
0,
8538
0,
8539
0,
8540
0,
8541
0,
8542
0,
8543
0,
8544
0,
8545
0,
8546
0,
8547
0,
8548
#if PY_VERSION_HEX >= 0x030400a1
8549
0,
8550
#endif
8551
};
8552
static int __pyx_CyFunction_init(void) {
8553
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
8554
if (__pyx_CyFunctionType == NULL) {
8555
return -1;
8556
}
8557
return 0;
8558
}
8559
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
8560
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8561
m->defaults = PyObject_Malloc(size);
8562
if (!m->defaults)
8563
return PyErr_NoMemory();
8564
memset(m->defaults, 0, size);
8565
m->defaults_pyobjects = pyobjects;
8566
return m->defaults;
8567
}
8568
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
8569
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8570
m->defaults_tuple = tuple;
8571
Py_INCREF(tuple);
8572
}
8573
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
8574
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8575
m->defaults_kwdict = dict;
8576
Py_INCREF(dict);
8577
}
8578
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
8579
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
8580
m->func_annotations = dict;
8581
Py_INCREF(dict);
8582
}
8583
8584
/* GetVTable */
8585
static void* __Pyx_GetVtable(PyObject *dict) {
8586
void* ptr;
8587
PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
8588
if (!ob)
8589
goto bad;
8590
#if PY_VERSION_HEX >= 0x02070000
8591
ptr = PyCapsule_GetPointer(ob, 0);
8592
#else
8593
ptr = PyCObject_AsVoidPtr(ob);
8594
#endif
8595
if (!ptr && !PyErr_Occurred())
8596
PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
8597
Py_DECREF(ob);
8598
return ptr;
8599
bad:
8600
Py_XDECREF(ob);
8601
return NULL;
8602
}
8603
8604
/* ImportFrom */
8605
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
8606
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
8607
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
8608
PyErr_Format(PyExc_ImportError,
8609
#if PY_MAJOR_VERSION < 3
8610
"cannot import name %.230s", PyString_AS_STRING(name));
8611
#else
8612
"cannot import name %S", name);
8613
#endif
8614
}
8615
return value;
8616
}
8617
8618
/* CodeObjectCache */
8619
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8620
int start = 0, mid = 0, end = count - 1;
8621
if (end >= 0 && code_line > entries[end].code_line) {
8622
return count;
8623
}
8624
while (start < end) {
8625
mid = start + (end - start) / 2;
8626
if (code_line < entries[mid].code_line) {
8627
end = mid;
8628
} else if (code_line > entries[mid].code_line) {
8629
start = mid + 1;
8630
} else {
8631
return mid;
8632
}
8633
}
8634
if (code_line <= entries[mid].code_line) {
8635
return mid;
8636
} else {
8637
return mid + 1;
8638
}
8639
}
8640
static PyCodeObject *__pyx_find_code_object(int code_line) {
8641
PyCodeObject* code_object;
8642
int pos;
8643
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8644
return NULL;
8645
}
8646
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8647
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8648
return NULL;
8649
}
8650
code_object = __pyx_code_cache.entries[pos].code_object;
8651
Py_INCREF(code_object);
8652
return code_object;
8653
}
8654
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8655
int pos, i;
8656
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8657
if (unlikely(!code_line)) {
8658
return;
8659
}
8660
if (unlikely(!entries)) {
8661
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
8662
if (likely(entries)) {
8663
__pyx_code_cache.entries = entries;
8664
__pyx_code_cache.max_count = 64;
8665
__pyx_code_cache.count = 1;
8666
entries[0].code_line = code_line;
8667
entries[0].code_object = code_object;
8668
Py_INCREF(code_object);
8669
}
8670
return;
8671
}
8672
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8673
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
8674
PyCodeObject* tmp = entries[pos].code_object;
8675
entries[pos].code_object = code_object;
8676
Py_DECREF(tmp);
8677
return;
8678
}
8679
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
8680
int new_max = __pyx_code_cache.max_count + 64;
8681
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
8682
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
8683
if (unlikely(!entries)) {
8684
return;
8685
}
8686
__pyx_code_cache.entries = entries;
8687
__pyx_code_cache.max_count = new_max;
8688
}
8689
for (i=__pyx_code_cache.count; i>pos; i--) {
8690
entries[i] = entries[i-1];
8691
}
8692
entries[pos].code_line = code_line;
8693
entries[pos].code_object = code_object;
8694
__pyx_code_cache.count++;
8695
Py_INCREF(code_object);
8696
}
8697
8698
/* AddTraceback */
8699
#include "compile.h"
8700
#include "frameobject.h"
8701
#include "traceback.h"
8702
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
8703
const char *funcname, int c_line,
8704
int py_line, const char *filename) {
8705
PyCodeObject *py_code = 0;
8706
PyObject *py_srcfile = 0;
8707
PyObject *py_funcname = 0;
8708
#if PY_MAJOR_VERSION < 3
8709
py_srcfile = PyString_FromString(filename);
8710
#else
8711
py_srcfile = PyUnicode_FromString(filename);
8712
#endif
8713
if (!py_srcfile) goto bad;
8714
if (c_line) {
8715
#if PY_MAJOR_VERSION < 3
8716
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8717
#else
8718
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8719
#endif
8720
}
8721
else {
8722
#if PY_MAJOR_VERSION < 3
8723
py_funcname = PyString_FromString(funcname);
8724
#else
8725
py_funcname = PyUnicode_FromString(funcname);
8726
#endif
8727
}
8728
if (!py_funcname) goto bad;
8729
py_code = __Pyx_PyCode_New(
8730
0,
8731
0,
8732
0,
8733
0,
8734
0,
8735
__pyx_empty_bytes, /*PyObject *code,*/
8736
__pyx_empty_tuple, /*PyObject *consts,*/
8737
__pyx_empty_tuple, /*PyObject *names,*/
8738
__pyx_empty_tuple, /*PyObject *varnames,*/
8739
__pyx_empty_tuple, /*PyObject *freevars,*/
8740
__pyx_empty_tuple, /*PyObject *cellvars,*/
8741
py_srcfile, /*PyObject *filename,*/
8742
py_funcname, /*PyObject *name,*/
8743
py_line,
8744
__pyx_empty_bytes /*PyObject *lnotab*/
8745
);
8746
Py_DECREF(py_srcfile);
8747
Py_DECREF(py_funcname);
8748
return py_code;
8749
bad:
8750
Py_XDECREF(py_srcfile);
8751
Py_XDECREF(py_funcname);
8752
return NULL;
8753
}
8754
static void __Pyx_AddTraceback(const char *funcname, int c_line,
8755
int py_line, const char *filename) {
8756
PyCodeObject *py_code = 0;
8757
PyFrameObject *py_frame = 0;
8758
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
8759
if (!py_code) {
8760
py_code = __Pyx_CreateCodeObjectForTraceback(
8761
funcname, c_line, py_line, filename);
8762
if (!py_code) goto bad;
8763
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
8764
}
8765
py_frame = PyFrame_New(
8766
PyThreadState_GET(), /*PyThreadState *tstate,*/
8767
py_code, /*PyCodeObject *code,*/
8768
__pyx_d, /*PyObject *globals,*/
8769
0 /*PyObject *locals*/
8770
);
8771
if (!py_frame) goto bad;
8772
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
8773
PyTraceBack_Here(py_frame);
8774
bad:
8775
Py_XDECREF(py_code);
8776
Py_XDECREF(py_frame);
8777
}
8778
8779
/* CIntFromPyVerify */
8780
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
8781
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
8782
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
8783
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
8784
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
8785
{\
8786
func_type value = func_value;\
8787
if (sizeof(target_type) < sizeof(func_type)) {\
8788
if (unlikely(value != (func_type) (target_type) value)) {\
8789
func_type zero = 0;\
8790
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
8791
return (target_type) -1;\
8792
if (is_unsigned && unlikely(value < zero))\
8793
goto raise_neg_overflow;\
8794
else\
8795
goto raise_overflow;\
8796
}\
8797
}\
8798
return (target_type) value;\
8799
}
8800
8801
/* CIntToPy */
8802
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
8803
const int neg_one = (int) -1, const_zero = (int) 0;
8804
const int is_unsigned = neg_one > const_zero;
8805
if (is_unsigned) {
8806
if (sizeof(int) < sizeof(long)) {
8807
return PyInt_FromLong((long) value);
8808
} else if (sizeof(int) <= sizeof(unsigned long)) {
8809
return PyLong_FromUnsignedLong((unsigned long) value);
8810
#ifdef HAVE_LONG_LONG
8811
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8812
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8813
#endif
8814
}
8815
} else {
8816
if (sizeof(int) <= sizeof(long)) {
8817
return PyInt_FromLong((long) value);
8818
#ifdef HAVE_LONG_LONG
8819
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
8820
return PyLong_FromLongLong((PY_LONG_LONG) value);
8821
#endif
8822
}
8823
}
8824
{
8825
int one = 1; int little = (int)*(unsigned char *)&one;
8826
unsigned char *bytes = (unsigned char *)&value;
8827
return _PyLong_FromByteArray(bytes, sizeof(int),
8828
little, !is_unsigned);
8829
}
8830
}
8831
8832
/* CIntFromPy */
8833
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
8834
const int neg_one = (int) -1, const_zero = (int) 0;
8835
const int is_unsigned = neg_one > const_zero;
8836
#if PY_MAJOR_VERSION < 3
8837
if (likely(PyInt_Check(x))) {
8838
if (sizeof(int) < sizeof(long)) {
8839
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
8840
} else {
8841
long val = PyInt_AS_LONG(x);
8842
if (is_unsigned && unlikely(val < 0)) {
8843
goto raise_neg_overflow;
8844
}
8845
return (int) val;
8846
}
8847
} else
8848
#endif
8849
if (likely(PyLong_Check(x))) {
8850
if (is_unsigned) {
8851
#if CYTHON_USE_PYLONG_INTERNALS
8852
const digit* digits = ((PyLongObject*)x)->ob_digit;
8853
switch (Py_SIZE(x)) {
8854
case 0: return (int) 0;
8855
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
8856
case 2:
8857
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8858
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8859
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8860
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
8861
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8862
}
8863
}
8864
break;
8865
case 3:
8866
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8867
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8868
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8869
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
8870
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8871
}
8872
}
8873
break;
8874
case 4:
8875
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8876
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8877
__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])))
8878
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
8879
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8880
}
8881
}
8882
break;
8883
}
8884
#endif
8885
#if CYTHON_COMPILING_IN_CPYTHON
8886
if (unlikely(Py_SIZE(x) < 0)) {
8887
goto raise_neg_overflow;
8888
}
8889
#else
8890
{
8891
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8892
if (unlikely(result < 0))
8893
return (int) -1;
8894
if (unlikely(result == 1))
8895
goto raise_neg_overflow;
8896
}
8897
#endif
8898
if (sizeof(int) <= sizeof(unsigned long)) {
8899
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
8900
#ifdef HAVE_LONG_LONG
8901
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8902
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8903
#endif
8904
}
8905
} else {
8906
#if CYTHON_USE_PYLONG_INTERNALS
8907
const digit* digits = ((PyLongObject*)x)->ob_digit;
8908
switch (Py_SIZE(x)) {
8909
case 0: return (int) 0;
8910
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
8911
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
8912
case -2:
8913
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
8914
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8915
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8916
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8917
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8918
}
8919
}
8920
break;
8921
case 2:
8922
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8923
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8924
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8925
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8926
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8927
}
8928
}
8929
break;
8930
case -3:
8931
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8932
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8933
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8934
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8935
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8936
}
8937
}
8938
break;
8939
case 3:
8940
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8941
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8942
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8943
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8944
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8945
}
8946
}
8947
break;
8948
case -4:
8949
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8950
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8951
__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])))
8952
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
8953
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8954
}
8955
}
8956
break;
8957
case 4:
8958
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8959
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8960
__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])))
8961
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
8962
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8963
}
8964
}
8965
break;
8966
}
8967
#endif
8968
if (sizeof(int) <= sizeof(long)) {
8969
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
8970
#ifdef HAVE_LONG_LONG
8971
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
8972
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
8973
#endif
8974
}
8975
}
8976
{
8977
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8978
PyErr_SetString(PyExc_RuntimeError,
8979
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8980
#else
8981
int val;
8982
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8983
#if PY_MAJOR_VERSION < 3
8984
if (likely(v) && !PyLong_Check(v)) {
8985
PyObject *tmp = v;
8986
v = PyNumber_Long(tmp);
8987
Py_DECREF(tmp);
8988
}
8989
#endif
8990
if (likely(v)) {
8991
int one = 1; int is_little = (int)*(unsigned char *)&one;
8992
unsigned char *bytes = (unsigned char *)&val;
8993
int ret = _PyLong_AsByteArray((PyLongObject *)v,
8994
bytes, sizeof(val),
8995
is_little, !is_unsigned);
8996
Py_DECREF(v);
8997
if (likely(!ret))
8998
return val;
8999
}
9000
#endif
9001
return (int) -1;
9002
}
9003
} else {
9004
int val;
9005
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9006
if (!tmp) return (int) -1;
9007
val = __Pyx_PyInt_As_int(tmp);
9008
Py_DECREF(tmp);
9009
return val;
9010
}
9011
raise_overflow:
9012
PyErr_SetString(PyExc_OverflowError,
9013
"value too large to convert to int");
9014
return (int) -1;
9015
raise_neg_overflow:
9016
PyErr_SetString(PyExc_OverflowError,
9017
"can't convert negative value to int");
9018
return (int) -1;
9019
}
9020
9021
/* CIntToPy */
9022
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
9023
const long neg_one = (long) -1, const_zero = (long) 0;
9024
const int is_unsigned = neg_one > const_zero;
9025
if (is_unsigned) {
9026
if (sizeof(long) < sizeof(long)) {
9027
return PyInt_FromLong((long) value);
9028
} else if (sizeof(long) <= sizeof(unsigned long)) {
9029
return PyLong_FromUnsignedLong((unsigned long) value);
9030
#ifdef HAVE_LONG_LONG
9031
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9032
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9033
#endif
9034
}
9035
} else {
9036
if (sizeof(long) <= sizeof(long)) {
9037
return PyInt_FromLong((long) value);
9038
#ifdef HAVE_LONG_LONG
9039
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9040
return PyLong_FromLongLong((PY_LONG_LONG) value);
9041
#endif
9042
}
9043
}
9044
{
9045
int one = 1; int little = (int)*(unsigned char *)&one;
9046
unsigned char *bytes = (unsigned char *)&value;
9047
return _PyLong_FromByteArray(bytes, sizeof(long),
9048
little, !is_unsigned);
9049
}
9050
}
9051
9052
/* CIntFromPy */
9053
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
9054
const long neg_one = (long) -1, const_zero = (long) 0;
9055
const int is_unsigned = neg_one > const_zero;
9056
#if PY_MAJOR_VERSION < 3
9057
if (likely(PyInt_Check(x))) {
9058
if (sizeof(long) < sizeof(long)) {
9059
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
9060
} else {
9061
long val = PyInt_AS_LONG(x);
9062
if (is_unsigned && unlikely(val < 0)) {
9063
goto raise_neg_overflow;
9064
}
9065
return (long) val;
9066
}
9067
} else
9068
#endif
9069
if (likely(PyLong_Check(x))) {
9070
if (is_unsigned) {
9071
#if CYTHON_USE_PYLONG_INTERNALS
9072
const digit* digits = ((PyLongObject*)x)->ob_digit;
9073
switch (Py_SIZE(x)) {
9074
case 0: return (long) 0;
9075
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
9076
case 2:
9077
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9078
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9079
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9080
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
9081
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9082
}
9083
}
9084
break;
9085
case 3:
9086
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9087
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9088
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9089
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
9090
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9091
}
9092
}
9093
break;
9094
case 4:
9095
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9096
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9097
__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])))
9098
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
9099
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
9100
}
9101
}
9102
break;
9103
}
9104
#endif
9105
#if CYTHON_COMPILING_IN_CPYTHON
9106
if (unlikely(Py_SIZE(x) < 0)) {
9107
goto raise_neg_overflow;
9108
}
9109
#else
9110
{
9111
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9112
if (unlikely(result < 0))
9113
return (long) -1;
9114
if (unlikely(result == 1))
9115
goto raise_neg_overflow;
9116
}
9117
#endif
9118
if (sizeof(long) <= sizeof(unsigned long)) {
9119
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
9120
#ifdef HAVE_LONG_LONG
9121
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9122
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9123
#endif
9124
}
9125
} else {
9126
#if CYTHON_USE_PYLONG_INTERNALS
9127
const digit* digits = ((PyLongObject*)x)->ob_digit;
9128
switch (Py_SIZE(x)) {
9129
case 0: return (long) 0;
9130
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
9131
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
9132
case -2:
9133
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
9134
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9135
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9136
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9137
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9138
}
9139
}
9140
break;
9141
case 2:
9142
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
9143
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9144
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9145
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9146
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9147
}
9148
}
9149
break;
9150
case -3:
9151
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
9152
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9153
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9154
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9155
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9156
}
9157
}
9158
break;
9159
case 3:
9160
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
9161
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9162
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9163
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9164
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9165
}
9166
}
9167
break;
9168
case -4:
9169
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
9170
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9171
__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])))
9172
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9173
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9174
}
9175
}
9176
break;
9177
case 4:
9178
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
9179
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9180
__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])))
9181
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
9182
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
9183
}
9184
}
9185
break;
9186
}
9187
#endif
9188
if (sizeof(long) <= sizeof(long)) {
9189
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
9190
#ifdef HAVE_LONG_LONG
9191
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9192
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
9193
#endif
9194
}
9195
}
9196
{
9197
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9198
PyErr_SetString(PyExc_RuntimeError,
9199
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9200
#else
9201
long val;
9202
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9203
#if PY_MAJOR_VERSION < 3
9204
if (likely(v) && !PyLong_Check(v)) {
9205
PyObject *tmp = v;
9206
v = PyNumber_Long(tmp);
9207
Py_DECREF(tmp);
9208
}
9209
#endif
9210
if (likely(v)) {
9211
int one = 1; int is_little = (int)*(unsigned char *)&one;
9212
unsigned char *bytes = (unsigned char *)&val;
9213
int ret = _PyLong_AsByteArray((PyLongObject *)v,
9214
bytes, sizeof(val),
9215
is_little, !is_unsigned);
9216
Py_DECREF(v);
9217
if (likely(!ret))
9218
return val;
9219
}
9220
#endif
9221
return (long) -1;
9222
}
9223
} else {
9224
long val;
9225
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9226
if (!tmp) return (long) -1;
9227
val = __Pyx_PyInt_As_long(tmp);
9228
Py_DECREF(tmp);
9229
return val;
9230
}
9231
raise_overflow:
9232
PyErr_SetString(PyExc_OverflowError,
9233
"value too large to convert to long");
9234
return (long) -1;
9235
raise_neg_overflow:
9236
PyErr_SetString(PyExc_OverflowError,
9237
"can't convert negative value to long");
9238
return (long) -1;
9239
}
9240
9241
/* CheckBinaryVersion */
9242
static int __Pyx_check_binary_version(void) {
9243
char ctversion[4], rtversion[4];
9244
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
9245
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
9246
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
9247
char message[200];
9248
PyOS_snprintf(message, sizeof(message),
9249
"compiletime version %s of module '%.100s' "
9250
"does not match runtime version %s",
9251
ctversion, __Pyx_MODULE_NAME, rtversion);
9252
return PyErr_WarnEx(NULL, message, 1);
9253
}
9254
return 0;
9255
}
9256
9257
/* ModuleImport */
9258
#ifndef __PYX_HAVE_RT_ImportModule
9259
#define __PYX_HAVE_RT_ImportModule
9260
static PyObject *__Pyx_ImportModule(const char *name) {
9261
PyObject *py_name = 0;
9262
PyObject *py_module = 0;
9263
py_name = __Pyx_PyIdentifier_FromString(name);
9264
if (!py_name)
9265
goto bad;
9266
py_module = PyImport_Import(py_name);
9267
Py_DECREF(py_name);
9268
return py_module;
9269
bad:
9270
Py_XDECREF(py_name);
9271
return 0;
9272
}
9273
#endif
9274
9275
/* TypeImport */
9276
#ifndef __PYX_HAVE_RT_ImportType
9277
#define __PYX_HAVE_RT_ImportType
9278
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
9279
size_t size, int strict)
9280
{
9281
PyObject *py_module = 0;
9282
PyObject *result = 0;
9283
PyObject *py_name = 0;
9284
char warning[200];
9285
Py_ssize_t basicsize;
9286
#ifdef Py_LIMITED_API
9287
PyObject *py_basicsize;
9288
#endif
9289
py_module = __Pyx_ImportModule(module_name);
9290
if (!py_module)
9291
goto bad;
9292
py_name = __Pyx_PyIdentifier_FromString(class_name);
9293
if (!py_name)
9294
goto bad;
9295
result = PyObject_GetAttr(py_module, py_name);
9296
Py_DECREF(py_name);
9297
py_name = 0;
9298
Py_DECREF(py_module);
9299
py_module = 0;
9300
if (!result)
9301
goto bad;
9302
if (!PyType_Check(result)) {
9303
PyErr_Format(PyExc_TypeError,
9304
"%.200s.%.200s is not a type object",
9305
module_name, class_name);
9306
goto bad;
9307
}
9308
#ifndef Py_LIMITED_API
9309
basicsize = ((PyTypeObject *)result)->tp_basicsize;
9310
#else
9311
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
9312
if (!py_basicsize)
9313
goto bad;
9314
basicsize = PyLong_AsSsize_t(py_basicsize);
9315
Py_DECREF(py_basicsize);
9316
py_basicsize = 0;
9317
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
9318
goto bad;
9319
#endif
9320
if (!strict && (size_t)basicsize > size) {
9321
PyOS_snprintf(warning, sizeof(warning),
9322
"%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
9323
module_name, class_name, basicsize, size);
9324
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
9325
}
9326
else if ((size_t)basicsize != size) {
9327
PyErr_Format(PyExc_ValueError,
9328
"%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
9329
module_name, class_name, basicsize, size);
9330
goto bad;
9331
}
9332
return (PyTypeObject *)result;
9333
bad:
9334
Py_XDECREF(py_module);
9335
Py_XDECREF(result);
9336
return NULL;
9337
}
9338
#endif
9339
9340
/* VoidPtrImport */
9341
#ifndef __PYX_HAVE_RT_ImportVoidPtr
9342
#define __PYX_HAVE_RT_ImportVoidPtr
9343
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
9344
PyObject *d = 0;
9345
PyObject *cobj = 0;
9346
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
9347
if (!d)
9348
goto bad;
9349
cobj = PyDict_GetItemString(d, name);
9350
if (!cobj) {
9351
PyErr_Format(PyExc_ImportError,
9352
"%.200s does not export expected C variable %.200s",
9353
PyModule_GetName(module), name);
9354
goto bad;
9355
}
9356
#if PY_VERSION_HEX >= 0x02070000
9357
if (!PyCapsule_IsValid(cobj, sig)) {
9358
PyErr_Format(PyExc_TypeError,
9359
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
9360
PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
9361
goto bad;
9362
}
9363
*p = PyCapsule_GetPointer(cobj, sig);
9364
#else
9365
{const char *desc, *s1, *s2;
9366
desc = (const char *)PyCObject_GetDesc(cobj);
9367
if (!desc)
9368
goto bad;
9369
s1 = desc; s2 = sig;
9370
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
9371
if (*s1 != *s2) {
9372
PyErr_Format(PyExc_TypeError,
9373
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
9374
PyModule_GetName(module), name, sig, desc);
9375
goto bad;
9376
}
9377
*p = PyCObject_AsVoidPtr(cobj);}
9378
#endif
9379
if (!(*p))
9380
goto bad;
9381
Py_DECREF(d);
9382
return 0;
9383
bad:
9384
Py_XDECREF(d);
9385
return -1;
9386
}
9387
#endif
9388
9389
/* InitStrings */
9390
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9391
while (t->p) {
9392
#if PY_MAJOR_VERSION < 3
9393
if (t->is_unicode) {
9394
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9395
} else if (t->intern) {
9396
*t->p = PyString_InternFromString(t->s);
9397
} else {
9398
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9399
}
9400
#else
9401
if (t->is_unicode | t->is_str) {
9402
if (t->intern) {
9403
*t->p = PyUnicode_InternFromString(t->s);
9404
} else if (t->encoding) {
9405
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9406
} else {
9407
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9408
}
9409
} else {
9410
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9411
}
9412
#endif
9413
if (!*t->p)
9414
return -1;
9415
++t;
9416
}
9417
return 0;
9418
}
9419
9420
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
9421
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
9422
}
9423
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
9424
Py_ssize_t ignore;
9425
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
9426
}
9427
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9428
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
9429
if (
9430
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9431
__Pyx_sys_getdefaultencoding_not_ascii &&
9432
#endif
9433
PyUnicode_Check(o)) {
9434
#if PY_VERSION_HEX < 0x03030000
9435
char* defenc_c;
9436
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
9437
if (!defenc) return NULL;
9438
defenc_c = PyBytes_AS_STRING(defenc);
9439
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9440
{
9441
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
9442
char* c;
9443
for (c = defenc_c; c < end; c++) {
9444
if ((unsigned char) (*c) >= 128) {
9445
PyUnicode_AsASCIIString(o);
9446
return NULL;
9447
}
9448
}
9449
}
9450
#endif
9451
*length = PyBytes_GET_SIZE(defenc);
9452
return defenc_c;
9453
#else
9454
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
9455
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9456
if (PyUnicode_IS_ASCII(o)) {
9457
*length = PyUnicode_GET_LENGTH(o);
9458
return PyUnicode_AsUTF8(o);
9459
} else {
9460
PyUnicode_AsASCIIString(o);
9461
return NULL;
9462
}
9463
#else
9464
return PyUnicode_AsUTF8AndSize(o, length);
9465
#endif
9466
#endif
9467
} else
9468
#endif
9469
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
9470
if (PyByteArray_Check(o)) {
9471
*length = PyByteArray_GET_SIZE(o);
9472
return PyByteArray_AS_STRING(o);
9473
} else
9474
#endif
9475
{
9476
char* result;
9477
int r = PyBytes_AsStringAndSize(o, &result, length);
9478
if (unlikely(r < 0)) {
9479
return NULL;
9480
} else {
9481
return result;
9482
}
9483
}
9484
}
9485
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
9486
int is_true = x == Py_True;
9487
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
9488
else return PyObject_IsTrue(x);
9489
}
9490
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
9491
#if CYTHON_USE_TYPE_SLOTS
9492
PyNumberMethods *m;
9493
#endif
9494
const char *name = NULL;
9495
PyObject *res = NULL;
9496
#if PY_MAJOR_VERSION < 3
9497
if (PyInt_Check(x) || PyLong_Check(x))
9498
#else
9499
if (PyLong_Check(x))
9500
#endif
9501
return __Pyx_NewRef(x);
9502
#if CYTHON_USE_TYPE_SLOTS
9503
m = Py_TYPE(x)->tp_as_number;
9504
#if PY_MAJOR_VERSION < 3
9505
if (m && m->nb_int) {
9506
name = "int";
9507
res = PyNumber_Int(x);
9508
}
9509
else if (m && m->nb_long) {
9510
name = "long";
9511
res = PyNumber_Long(x);
9512
}
9513
#else
9514
if (m && m->nb_int) {
9515
name = "int";
9516
res = PyNumber_Long(x);
9517
}
9518
#endif
9519
#else
9520
res = PyNumber_Int(x);
9521
#endif
9522
if (res) {
9523
#if PY_MAJOR_VERSION < 3
9524
if (!PyInt_Check(res) && !PyLong_Check(res)) {
9525
#else
9526
if (!PyLong_Check(res)) {
9527
#endif
9528
PyErr_Format(PyExc_TypeError,
9529
"__%.4s__ returned non-%.4s (type %.200s)",
9530
name, name, Py_TYPE(res)->tp_name);
9531
Py_DECREF(res);
9532
return NULL;
9533
}
9534
}
9535
else if (!PyErr_Occurred()) {
9536
PyErr_SetString(PyExc_TypeError,
9537
"an integer is required");
9538
}
9539
return res;
9540
}
9541
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
9542
Py_ssize_t ival;
9543
PyObject *x;
9544
#if PY_MAJOR_VERSION < 3
9545
if (likely(PyInt_CheckExact(b))) {
9546
if (sizeof(Py_ssize_t) >= sizeof(long))
9547
return PyInt_AS_LONG(b);
9548
else
9549
return PyInt_AsSsize_t(x);
9550
}
9551
#endif
9552
if (likely(PyLong_CheckExact(b))) {
9553
#if CYTHON_USE_PYLONG_INTERNALS
9554
const digit* digits = ((PyLongObject*)b)->ob_digit;
9555
const Py_ssize_t size = Py_SIZE(b);
9556
if (likely(__Pyx_sst_abs(size) <= 1)) {
9557
ival = likely(size) ? digits[0] : 0;
9558
if (size == -1) ival = -ival;
9559
return ival;
9560
} else {
9561
switch (size) {
9562
case 2:
9563
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9564
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9565
}
9566
break;
9567
case -2:
9568
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9569
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9570
}
9571
break;
9572
case 3:
9573
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9574
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9575
}
9576
break;
9577
case -3:
9578
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9579
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9580
}
9581
break;
9582
case 4:
9583
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9584
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]));
9585
}
9586
break;
9587
case -4:
9588
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9589
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]));
9590
}
9591
break;
9592
}
9593
}
9594
#endif
9595
return PyLong_AsSsize_t(b);
9596
}
9597
x = PyNumber_Index(b);
9598
if (!x) return -1;
9599
ival = PyInt_AsSsize_t(x);
9600
Py_DECREF(x);
9601
return ival;
9602
}
9603
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
9604
return PyInt_FromSize_t(ival);
9605
}
9606
9607
9608
#endif /* Py_PYTHON_H */
9609
9610