1
/* Generated by Cython 0.12.1 on Mon Sep 13 10:01:55 2010 */
3
#define PY_SSIZE_T_CLEAN
5
#include "structmember.h"
7
#error Python headers needed to compile C extensions, please install development version of Python.
11
#define PY_LONG_LONG LONG_LONG
14
#define DL_EXPORT(t) t
16
#if PY_VERSION_HEX < 0x02040000
17
#define METH_COEXIST 0
18
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
19
#define PyDict_Contains(d,o) PySequence_Contains(d,o)
22
#if PY_VERSION_HEX < 0x02050000
23
typedef int Py_ssize_t;
24
#define PY_SSIZE_T_MAX INT_MAX
25
#define PY_SSIZE_T_MIN INT_MIN
26
#define PY_FORMAT_SIZE_T ""
27
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
28
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
29
#define PyNumber_Index(o) PyNumber_Int(o)
30
#define PyIndex_Check(o) PyNumber_Check(o)
31
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
34
#if PY_VERSION_HEX < 0x02060000
35
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
36
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
37
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
38
#define PyVarObject_HEAD_INIT(type, size) \
39
PyObject_HEAD_INIT(type) size,
40
#define PyType_Modified(t)
52
Py_ssize_t *suboffsets;
56
#define PyBUF_SIMPLE 0
57
#define PyBUF_WRITABLE 0x0001
58
#define PyBUF_FORMAT 0x0004
59
#define PyBUF_ND 0x0008
60
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
61
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
62
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
63
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
64
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
68
#if PY_MAJOR_VERSION < 3
69
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
71
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
74
#if PY_MAJOR_VERSION >= 3
75
#define Py_TPFLAGS_CHECKTYPES 0
76
#define Py_TPFLAGS_HAVE_INDEX 0
79
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
80
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
83
#if PY_MAJOR_VERSION >= 3
84
#define PyBaseString_Type PyUnicode_Type
85
#define PyString_Type PyUnicode_Type
86
#define PyString_CheckExact PyUnicode_CheckExact
88
#define PyBytes_Type PyString_Type
89
#define PyBytes_CheckExact PyString_CheckExact
92
#if PY_MAJOR_VERSION >= 3
93
#define PyInt_Type PyLong_Type
94
#define PyInt_Check(op) PyLong_Check(op)
95
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
96
#define PyInt_FromString PyLong_FromString
97
#define PyInt_FromUnicode PyLong_FromUnicode
98
#define PyInt_FromLong PyLong_FromLong
99
#define PyInt_FromSize_t PyLong_FromSize_t
100
#define PyInt_FromSsize_t PyLong_FromSsize_t
101
#define PyInt_AsLong PyLong_AsLong
102
#define PyInt_AS_LONG PyLong_AS_LONG
103
#define PyInt_AsSsize_t PyLong_AsSsize_t
104
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
105
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
106
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
107
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
109
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
110
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
114
#if PY_MAJOR_VERSION >= 3
115
#define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
118
#if !defined(WIN32) && !defined(MS_WINDOWS)
129
#define _USE_MATH_DEFINES
132
#if PY_VERSION_HEX < 0x02050000
133
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
134
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
135
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
137
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
138
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
139
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
142
#if PY_VERSION_HEX < 0x02050000
143
#define __Pyx_NAMESTR(n) ((char *)(n))
144
#define __Pyx_DOCSTR(n) ((char *)(n))
146
#define __Pyx_NAMESTR(n) (n)
147
#define __Pyx_DOCSTR(n) (n)
150
#define __PYX_EXTERN_C extern "C"
152
#define __PYX_EXTERN_C extern
155
#define __PYX_HAVE_API__cogent__maths___period
158
#include "numpy/arrayobject.h"
159
#include "numpy/ufuncobject.h"
161
#ifndef CYTHON_INLINE
162
#if defined(__GNUC__)
163
#define CYTHON_INLINE __inline__
164
#elif defined(_MSC_VER)
165
#define CYTHON_INLINE __inline
167
#define CYTHON_INLINE
171
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
174
/* Type Conversion Predeclarations */
176
#if PY_MAJOR_VERSION < 3
177
#define __Pyx_PyBytes_FromString PyString_FromString
178
#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize
179
#define __Pyx_PyBytes_AsString PyString_AsString
181
#define __Pyx_PyBytes_FromString PyBytes_FromString
182
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
183
#define __Pyx_PyBytes_AsString PyBytes_AsString
186
#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
187
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s))
189
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
190
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
191
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
193
#if !defined(T_PYSSIZET)
194
#if PY_VERSION_HEX < 0x02050000
195
#define T_PYSSIZET T_INT
196
#elif !defined(T_LONGLONG)
198
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
199
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
202
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
203
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \
204
((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
209
#if !defined(T_ULONGLONG)
210
#define __Pyx_T_UNSIGNED_INT(x) \
211
((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \
212
((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
213
((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \
214
((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1))))
216
#define __Pyx_T_UNSIGNED_INT(x) \
217
((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \
218
((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
219
((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \
220
((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \
221
((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
223
#if !defined(T_LONGLONG)
224
#define __Pyx_T_SIGNED_INT(x) \
225
((sizeof(x) == sizeof(char)) ? T_BYTE : \
226
((sizeof(x) == sizeof(short)) ? T_SHORT : \
227
((sizeof(x) == sizeof(int)) ? T_INT : \
228
((sizeof(x) == sizeof(long)) ? T_LONG : -1))))
230
#define __Pyx_T_SIGNED_INT(x) \
231
((sizeof(x) == sizeof(char)) ? T_BYTE : \
232
((sizeof(x) == sizeof(short)) ? T_SHORT : \
233
((sizeof(x) == sizeof(int)) ? T_INT : \
234
((sizeof(x) == sizeof(long)) ? T_LONG : \
235
((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))))
238
#define __Pyx_T_FLOATING(x) \
239
((sizeof(x) == sizeof(float)) ? T_FLOAT : \
240
((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))
242
#if !defined(T_SIZET)
243
#if !defined(T_ULONGLONG)
245
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
246
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
249
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
250
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \
251
((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
255
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
256
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
257
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
259
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
263
/* Test for GCC > 2.95 */
264
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
265
#define likely(x) __builtin_expect(!!(x), 1)
266
#define unlikely(x) __builtin_expect(!!(x), 0)
267
#else /* __GNUC__ > 2 ... */
268
#define likely(x) (x)
269
#define unlikely(x) (x)
270
#endif /* __GNUC__ > 2 ... */
272
#define likely(x) (x)
273
#define unlikely(x) (x)
274
#endif /* __GNUC__ */
276
static PyObject *__pyx_m;
277
static PyObject *__pyx_b;
278
static PyObject *__pyx_empty_tuple;
279
static PyObject *__pyx_empty_bytes;
280
static int __pyx_lineno;
281
static int __pyx_clineno = 0;
282
static const char * __pyx_cfilenm= __FILE__;
283
static const char *__pyx_filename;
284
static const char **__pyx_f;
287
#if !defined(CYTHON_CCOMPLEX)
288
#if defined(__cplusplus)
289
#define CYTHON_CCOMPLEX 1
290
#elif defined(_Complex_I)
291
#define CYTHON_CCOMPLEX 1
293
#define CYTHON_CCOMPLEX 0
305
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
307
#define _Complex_I 1.0fj
310
typedef npy_int8 __pyx_t_5numpy_int8_t;
312
typedef npy_int16 __pyx_t_5numpy_int16_t;
314
typedef npy_int32 __pyx_t_5numpy_int32_t;
316
typedef npy_int64 __pyx_t_5numpy_int64_t;
318
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
320
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
322
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
324
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
326
typedef npy_float32 __pyx_t_5numpy_float32_t;
328
typedef npy_float64 __pyx_t_5numpy_float64_t;
330
typedef npy_long __pyx_t_5numpy_int_t;
332
typedef npy_longlong __pyx_t_5numpy_long_t;
334
typedef npy_intp __pyx_t_5numpy_intp_t;
336
typedef npy_uintp __pyx_t_5numpy_uintp_t;
338
typedef npy_ulong __pyx_t_5numpy_uint_t;
340
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
342
typedef npy_double __pyx_t_5numpy_float_t;
344
typedef npy_double __pyx_t_5numpy_double_t;
346
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
350
typedef ::std::complex< double > __pyx_t_double_complex;
352
typedef double _Complex __pyx_t_double_complex;
355
typedef struct { double real, imag; } __pyx_t_double_complex;
360
typedef ::std::complex< npy_float64 > __pyx_t_npy_float64_complex;
362
typedef npy_float64 _Complex __pyx_t_npy_float64_complex;
365
typedef struct { npy_float64 real, imag; } __pyx_t_npy_float64_complex;
370
typedef ::std::complex< float > __pyx_t_float_complex;
372
typedef float _Complex __pyx_t_float_complex;
375
typedef struct { float real, imag; } __pyx_t_float_complex;
378
/* Type declarations */
380
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
382
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
384
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
386
typedef npy_cdouble __pyx_t_5numpy_complex_t;
388
#ifndef CYTHON_REFNANNY
389
#define CYTHON_REFNANNY 0
394
void (*INCREF)(void*, PyObject*, int);
395
void (*DECREF)(void*, PyObject*, int);
396
void (*GOTREF)(void*, PyObject*, int);
397
void (*GIVEREF)(void*, PyObject*, int);
398
void* (*SetupContext)(const char*, int, const char*);
399
void (*FinishContext)(void**);
400
} __Pyx_RefNannyAPIStruct;
401
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
402
static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
403
PyObject *m = NULL, *p = NULL;
405
m = PyImport_ImportModule((char *)modname);
407
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
409
r = PyLong_AsVoidPtr(p);
413
return (__Pyx_RefNannyAPIStruct *)r;
415
#define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
416
#define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
417
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
418
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
419
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
420
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
421
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
423
#define __Pyx_RefNannySetupContext(name)
424
#define __Pyx_RefNannyFinishContext()
425
#define __Pyx_INCREF(r) Py_INCREF(r)
426
#define __Pyx_DECREF(r) Py_DECREF(r)
427
#define __Pyx_GOTREF(r)
428
#define __Pyx_GIVEREF(r)
429
#define __Pyx_XDECREF(r) Py_XDECREF(r)
430
#endif /* CYTHON_REFNANNY */
431
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
432
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
434
static void __Pyx_RaiseDoubleKeywordsError(
435
const char* func_name, PyObject* kw_name); /*proto*/
437
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
438
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
440
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
442
/* Run-time type information about structs used with buffers */
443
struct __Pyx_StructField_;
446
const char* name; /* for error messages only */
447
struct __Pyx_StructField_* fields;
448
size_t size; /* sizeof(type) */
449
char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
452
typedef struct __Pyx_StructField_ {
453
__Pyx_TypeInfo* type;
459
__Pyx_StructField* field;
460
size_t parent_offset;
461
} __Pyx_BufFmt_StackElem;
464
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
465
static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
466
static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
467
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
469
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
470
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
475
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
478
r = PyObject_GetItem(o, j);
484
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
485
__Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
486
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
488
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
489
if (likely(o != Py_None)) {
490
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
491
PyObject *r = PyList_GET_ITEM(o, i);
495
else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
496
PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
501
return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
504
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
505
__Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
506
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
508
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
509
if (likely(o != Py_None)) {
510
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
511
PyObject *r = PyTuple_GET_ITEM(o, i);
515
else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
516
PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
521
return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
525
#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
526
__Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
527
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
529
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
531
if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
532
r = PyList_GET_ITEM(o, i);
535
else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
536
r = PyTuple_GET_ITEM(o, i);
539
else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
540
r = PySequence_GetItem(o, i);
543
r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
548
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
550
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void);
552
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
553
static int __Pyx_EndUnpack(PyObject *); /*proto*/
555
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
557
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
559
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
561
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
562
const char *name, int exact); /*proto*/
563
#if PY_MAJOR_VERSION < 3
564
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
565
static void __Pyx_ReleaseBuffer(Py_buffer *view);
567
#define __Pyx_GetBuffer PyObject_GetBuffer
568
#define __Pyx_ReleaseBuffer PyBuffer_Release
571
Py_ssize_t __Pyx_zeros[] = {0};
572
Py_ssize_t __Pyx_minusones[] = {-1};
574
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
576
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
580
#define __Pyx_CREAL(z) ((z).real())
581
#define __Pyx_CIMAG(z) ((z).imag())
583
#define __Pyx_CREAL(z) (__real__(z))
584
#define __Pyx_CIMAG(z) (__imag__(z))
587
#define __Pyx_CREAL(z) ((z).real)
588
#define __Pyx_CIMAG(z) ((z).imag)
591
#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
592
#define __Pyx_SET_CREAL(z,x) ((z).real(x))
593
#define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
595
#define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
596
#define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
599
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
602
#define __Pyx_c_eq(a, b) ((a)==(b))
603
#define __Pyx_c_sum(a, b) ((a)+(b))
604
#define __Pyx_c_diff(a, b) ((a)-(b))
605
#define __Pyx_c_prod(a, b) ((a)*(b))
606
#define __Pyx_c_quot(a, b) ((a)/(b))
607
#define __Pyx_c_neg(a) (-(a))
609
#define __Pyx_c_is_zero(z) ((z)==(double)0)
610
#define __Pyx_c_conj(z) (::std::conj(z))
611
/*#define __Pyx_c_abs(z) (::std::abs(z))*/
613
#define __Pyx_c_is_zero(z) ((z)==0)
614
#define __Pyx_c_conj(z) (conj(z))
615
/*#define __Pyx_c_abs(z) (cabs(z))*/
618
static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
619
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
620
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
621
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
622
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
623
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
624
static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
625
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
626
/*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/
629
static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64, npy_float64);
632
#define __Pyx_c_eq_npy_float64(a, b) ((a)==(b))
633
#define __Pyx_c_sum_npy_float64(a, b) ((a)+(b))
634
#define __Pyx_c_diff_npy_float64(a, b) ((a)-(b))
635
#define __Pyx_c_prod_npy_float64(a, b) ((a)*(b))
636
#define __Pyx_c_quot_npy_float64(a, b) ((a)/(b))
637
#define __Pyx_c_neg_npy_float64(a) (-(a))
639
#define __Pyx_c_is_zero_npy_float64(z) ((z)==(npy_float64)0)
640
#define __Pyx_c_conj_npy_float64(z) (::std::conj(z))
641
/*#define __Pyx_c_abs_npy_float64(z) (::std::abs(z))*/
643
#define __Pyx_c_is_zero_npy_float64(z) ((z)==0)
644
#define __Pyx_c_conj_npy_float64(z) (conj_npy_float64(z))
645
/*#define __Pyx_c_abs_npy_float64(z) (cabs_npy_float64(z))*/
648
static CYTHON_INLINE int __Pyx_c_eq_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex);
649
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_sum_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex);
650
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_diff_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex);
651
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex);
652
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_quot_npy_float64(__pyx_t_npy_float64_complex, __pyx_t_npy_float64_complex);
653
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_neg_npy_float64(__pyx_t_npy_float64_complex);
654
static CYTHON_INLINE int __Pyx_c_is_zero_npy_float64(__pyx_t_npy_float64_complex);
655
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_conj_npy_float64(__pyx_t_npy_float64_complex);
656
/*static CYTHON_INLINE npy_float64 __Pyx_c_abs_npy_float64(__pyx_t_npy_float64_complex);*/
659
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
662
#define __Pyx_c_eqf(a, b) ((a)==(b))
663
#define __Pyx_c_sumf(a, b) ((a)+(b))
664
#define __Pyx_c_difff(a, b) ((a)-(b))
665
#define __Pyx_c_prodf(a, b) ((a)*(b))
666
#define __Pyx_c_quotf(a, b) ((a)/(b))
667
#define __Pyx_c_negf(a) (-(a))
669
#define __Pyx_c_is_zerof(z) ((z)==(float)0)
670
#define __Pyx_c_conjf(z) (::std::conj(z))
671
/*#define __Pyx_c_absf(z) (::std::abs(z))*/
673
#define __Pyx_c_is_zerof(z) ((z)==0)
674
#define __Pyx_c_conjf(z) (conjf(z))
675
/*#define __Pyx_c_absf(z) (cabsf(z))*/
678
static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
679
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
680
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
681
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
682
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
683
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
684
static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
685
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
686
/*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/
689
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
691
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
693
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
695
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
697
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
699
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
701
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
703
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
705
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
707
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
709
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
711
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
713
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
715
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
717
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
719
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
721
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/
723
static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
725
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
727
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
728
/* Module declarations from python_buffer */
730
/* Module declarations from python_ref */
732
/* Module declarations from stdlib */
734
/* Module declarations from stdio */
736
/* Module declarations from numpy */
738
/* Module declarations from numpy */
740
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
741
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
742
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
743
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
744
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
745
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
746
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
747
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
748
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
749
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
750
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
751
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
752
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/
753
/* Module declarations from cogent.maths._period */
755
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "numpy.float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), 'R' };
756
static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex", NULL, sizeof(__pyx_t_double_complex), 'C' };
757
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "numpy.uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), 'U' };
758
#define __Pyx_MODULE_NAME "cogent.maths._period"
759
int __pyx_module_is_main_cogent__maths___period = 0;
761
/* Implementation of cogent.maths._period */
762
static PyObject *__pyx_builtin_range;
763
static PyObject *__pyx_builtin_ValueError;
764
static PyObject *__pyx_builtin_RuntimeError;
765
static char __pyx_k_1[] = "ndarray is not C contiguous";
766
static char __pyx_k_2[] = "ndarray is not Fortran contiguous";
767
static char __pyx_k_3[] = "Non-native byte order not supported";
768
static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)";
769
static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd";
770
static char __pyx_k_6[] = "Format string allocated too short.";
771
static char __pyx_k_7[] = "goertzel_inner (line 6)";
772
static char __pyx_k_8[] = "ipdft_inner (line 22)";
773
static char __pyx_k__B[] = "B";
774
static char __pyx_k__H[] = "H";
775
static char __pyx_k__I[] = "I";
776
static char __pyx_k__L[] = "L";
777
static char __pyx_k__N[] = "N";
778
static char __pyx_k__O[] = "O";
779
static char __pyx_k__Q[] = "Q";
780
static char __pyx_k__W[] = "W";
781
static char __pyx_k__X[] = "X";
782
static char __pyx_k__b[] = "b";
783
static char __pyx_k__d[] = "d";
784
static char __pyx_k__f[] = "f";
785
static char __pyx_k__g[] = "g";
786
static char __pyx_k__h[] = "h";
787
static char __pyx_k__i[] = "i";
788
static char __pyx_k__l[] = "l";
789
static char __pyx_k__q[] = "q";
790
static char __pyx_k__x[] = "x";
791
static char __pyx_k__Zd[] = "Zd";
792
static char __pyx_k__Zf[] = "Zf";
793
static char __pyx_k__Zg[] = "Zg";
794
static char __pyx_k__pi[] = "pi";
795
static char __pyx_k__xc[] = "xc";
796
static char __pyx_k__buf[] = "buf";
797
static char __pyx_k__cos[] = "cos";
798
static char __pyx_k__exp[] = "exp";
799
static char __pyx_k__obj[] = "obj";
800
static char __pyx_k__seq[] = "seq";
801
static char __pyx_k__base[] = "base";
802
static char __pyx_k__ndim[] = "ndim";
803
static char __pyx_k__sqrt[] = "sqrt";
804
static char __pyx_k__ulim[] = "ulim";
805
static char __pyx_k__descr[] = "descr";
806
static char __pyx_k__names[] = "names";
807
static char __pyx_k__numpy[] = "numpy";
808
static char __pyx_k__range[] = "range";
809
static char __pyx_k__shape[] = "shape";
810
static char __pyx_k__fields[] = "fields";
811
static char __pyx_k__format[] = "format";
812
static char __pyx_k__motifs[] = "motifs";
813
static char __pyx_k__period[] = "period";
814
static char __pyx_k__result[] = "result";
815
static char __pyx_k__strides[] = "strides";
816
static char __pyx_k____main__[] = "__main__";
817
static char __pyx_k____test__[] = "__test__";
818
static char __pyx_k__itemsize[] = "itemsize";
819
static char __pyx_k__readonly[] = "readonly";
820
static char __pyx_k__type_num[] = "type_num";
821
static char __pyx_k__byteorder[] = "byteorder";
822
static char __pyx_k__ValueError[] = "ValueError";
823
static char __pyx_k__suboffsets[] = "suboffsets";
824
static char __pyx_k__ipdft_inner[] = "ipdft_inner";
825
static char __pyx_k__RuntimeError[] = "RuntimeError";
826
static char __pyx_k__motif_length[] = "motif_length";
827
static char __pyx_k__goertzel_inner[] = "goertzel_inner";
828
static PyObject *__pyx_kp_u_1;
829
static PyObject *__pyx_kp_u_2;
830
static PyObject *__pyx_kp_u_3;
831
static PyObject *__pyx_kp_u_4;
832
static PyObject *__pyx_kp_u_5;
833
static PyObject *__pyx_kp_u_6;
834
static PyObject *__pyx_kp_u_7;
835
static PyObject *__pyx_kp_u_8;
836
static PyObject *__pyx_n_s__N;
837
static PyObject *__pyx_n_s__RuntimeError;
838
static PyObject *__pyx_n_s__ValueError;
839
static PyObject *__pyx_n_s__W;
840
static PyObject *__pyx_n_s__X;
841
static PyObject *__pyx_n_s____main__;
842
static PyObject *__pyx_n_s____test__;
843
static PyObject *__pyx_n_s__base;
844
static PyObject *__pyx_n_s__buf;
845
static PyObject *__pyx_n_s__byteorder;
846
static PyObject *__pyx_n_s__cos;
847
static PyObject *__pyx_n_s__descr;
848
static PyObject *__pyx_n_s__exp;
849
static PyObject *__pyx_n_s__fields;
850
static PyObject *__pyx_n_s__format;
851
static PyObject *__pyx_n_s__goertzel_inner;
852
static PyObject *__pyx_n_s__ipdft_inner;
853
static PyObject *__pyx_n_s__itemsize;
854
static PyObject *__pyx_n_s__motif_length;
855
static PyObject *__pyx_n_s__motifs;
856
static PyObject *__pyx_n_s__names;
857
static PyObject *__pyx_n_s__ndim;
858
static PyObject *__pyx_n_s__numpy;
859
static PyObject *__pyx_n_s__obj;
860
static PyObject *__pyx_n_s__period;
861
static PyObject *__pyx_n_s__pi;
862
static PyObject *__pyx_n_s__range;
863
static PyObject *__pyx_n_s__readonly;
864
static PyObject *__pyx_n_s__result;
865
static PyObject *__pyx_n_s__seq;
866
static PyObject *__pyx_n_s__shape;
867
static PyObject *__pyx_n_s__sqrt;
868
static PyObject *__pyx_n_s__strides;
869
static PyObject *__pyx_n_s__suboffsets;
870
static PyObject *__pyx_n_s__type_num;
871
static PyObject *__pyx_n_s__ulim;
872
static PyObject *__pyx_n_s__x;
873
static PyObject *__pyx_n_s__xc;
874
static PyObject *__pyx_int_2;
875
static PyObject *__pyx_int_15;
877
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":6
878
* # TODO intro the version idea of peter's see email from him on Wednesday, 26 May 2010
880
* def goertzel_inner(np.ndarray[np.float64_t, ndim=1] x, int N, int period): # <<<<<<<<<<<<<<
881
* """returns the power from series x for period"""
885
static PyObject *__pyx_pf_6cogent_5maths_7_period_goertzel_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
886
static char __pyx_doc_6cogent_5maths_7_period_goertzel_inner[] = "returns the power from series x for period";
887
static PyObject *__pyx_pf_6cogent_5maths_7_period_goertzel_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
888
PyArrayObject *__pyx_v_x = 0;
892
__pyx_t_5numpy_float64_t __pyx_v_coeff;
893
__pyx_t_5numpy_float64_t __pyx_v_s;
894
__pyx_t_5numpy_float64_t __pyx_v_s_prev;
895
__pyx_t_5numpy_float64_t __pyx_v_s_prev2;
896
__pyx_t_5numpy_float64_t __pyx_v_power;
897
Py_buffer __pyx_bstruct_x;
898
Py_ssize_t __pyx_bstride_0_x = 0;
899
Py_ssize_t __pyx_bshape_0_x = 0;
900
PyObject *__pyx_r = NULL;
901
PyObject *__pyx_t_1 = NULL;
902
PyObject *__pyx_t_2 = NULL;
903
PyObject *__pyx_t_3 = NULL;
904
PyObject *__pyx_t_4 = NULL;
905
PyObject *__pyx_t_5 = NULL;
906
__pyx_t_5numpy_float64_t __pyx_t_6;
911
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__N,&__pyx_n_s__period,0};
912
__Pyx_RefNannySetupContext("goertzel_inner");
913
__pyx_self = __pyx_self;
914
if (unlikely(__pyx_kwds)) {
915
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
916
PyObject* values[3] = {0,0,0};
917
switch (PyTuple_GET_SIZE(__pyx_args)) {
918
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
919
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
920
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
922
default: goto __pyx_L5_argtuple_error;
924
switch (PyTuple_GET_SIZE(__pyx_args)) {
926
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
927
if (likely(values[0])) kw_args--;
928
else goto __pyx_L5_argtuple_error;
930
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__N);
931
if (likely(values[1])) kw_args--;
933
__Pyx_RaiseArgtupleInvalid("goertzel_inner", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
936
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__period);
937
if (likely(values[2])) kw_args--;
939
__Pyx_RaiseArgtupleInvalid("goertzel_inner", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
942
if (unlikely(kw_args > 0)) {
943
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "goertzel_inner") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
945
__pyx_v_x = ((PyArrayObject *)values[0]);
946
__pyx_v_N = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
947
__pyx_v_period = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_period == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
948
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
949
goto __pyx_L5_argtuple_error;
951
__pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
952
__pyx_v_N = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
953
__pyx_v_period = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_period == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
955
goto __pyx_L4_argument_unpacking_done;
956
__pyx_L5_argtuple_error:;
957
__Pyx_RaiseArgtupleInvalid("goertzel_inner", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
959
__Pyx_AddTraceback("cogent.maths._period.goertzel_inner");
961
__pyx_L4_argument_unpacking_done:;
962
__Pyx_INCREF((PyObject *)__pyx_v_x);
963
__pyx_bstruct_x.buf = NULL;
964
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
966
__Pyx_BufFmt_StackElem __pyx_stack[1];
967
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
969
__pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
970
__pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
972
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":11
973
* cdef np.float64_t coeff, s, s_prev, s_prev2, power
975
* coeff = 2.0 * cos(2 * pi / period) # <<<<<<<<<<<<<<
979
__pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
980
__Pyx_GOTREF(__pyx_t_1);
981
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__cos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
982
__Pyx_GOTREF(__pyx_t_2);
983
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__pi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
984
__Pyx_GOTREF(__pyx_t_3);
985
__pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
986
__Pyx_GOTREF(__pyx_t_4);
987
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
988
__pyx_t_3 = PyInt_FromLong(__pyx_v_period); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
989
__Pyx_GOTREF(__pyx_t_3);
990
__pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
991
__Pyx_GOTREF(__pyx_t_5);
992
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
993
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
994
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
995
__Pyx_GOTREF(__pyx_t_3);
996
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
997
__Pyx_GIVEREF(__pyx_t_5);
999
__pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1000
__Pyx_GOTREF(__pyx_t_5);
1001
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1002
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1003
__pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1004
__Pyx_GOTREF(__pyx_t_3);
1005
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1006
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1007
__pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1008
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1009
__pyx_v_coeff = __pyx_t_6;
1011
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":12
1013
* coeff = 2.0 * cos(2 * pi / period)
1014
* s_prev = 0.0 # <<<<<<<<<<<<<<
1016
* for n in range(N):
1018
__pyx_v_s_prev = 0.0;
1020
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":13
1021
* coeff = 2.0 * cos(2 * pi / period)
1023
* s_prev2 = 0.0 # <<<<<<<<<<<<<<
1024
* for n in range(N):
1025
* s = x[n] + coeff * s_prev - s_prev2
1027
__pyx_v_s_prev2 = 0.0;
1029
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":14
1032
* for n in range(N): # <<<<<<<<<<<<<<
1033
* s = x[n] + coeff * s_prev - s_prev2
1036
__pyx_t_7 = __pyx_v_N;
1037
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
1038
__pyx_v_n = __pyx_t_8;
1040
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":15
1042
* for n in range(N):
1043
* s = x[n] + coeff * s_prev - s_prev2 # <<<<<<<<<<<<<<
1047
__pyx_t_9 = __pyx_v_n;
1049
if (__pyx_t_9 < 0) {
1050
__pyx_t_9 += __pyx_bshape_0_x;
1051
if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
1052
} else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_x)) __pyx_t_10 = 0;
1053
if (unlikely(__pyx_t_10 != -1)) {
1054
__Pyx_RaiseBufferIndexError(__pyx_t_10);
1055
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1057
__pyx_v_s = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_9, __pyx_bstride_0_x)) + (__pyx_v_coeff * __pyx_v_s_prev)) - __pyx_v_s_prev2);
1059
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":16
1060
* for n in range(N):
1061
* s = x[n] + coeff * s_prev - s_prev2
1062
* s_prev2 = s_prev # <<<<<<<<<<<<<<
1066
__pyx_v_s_prev2 = __pyx_v_s_prev;
1068
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":17
1069
* s = x[n] + coeff * s_prev - s_prev2
1071
* s_prev = s # <<<<<<<<<<<<<<
1073
* power = sqrt(s_prev2**2 + s_prev**2 - coeff * s_prev2 * s_prev)
1075
__pyx_v_s_prev = __pyx_v_s;
1078
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":19
1081
* power = sqrt(s_prev2**2 + s_prev**2 - coeff * s_prev2 * s_prev) # <<<<<<<<<<<<<<
1085
__pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1086
__Pyx_GOTREF(__pyx_t_3);
1087
__pyx_t_5 = PyFloat_FromDouble(((pow(__pyx_v_s_prev2, 2) + pow(__pyx_v_s_prev, 2)) - ((__pyx_v_coeff * __pyx_v_s_prev2) * __pyx_v_s_prev))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1088
__Pyx_GOTREF(__pyx_t_5);
1089
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1090
__Pyx_GOTREF(__pyx_t_1);
1091
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
1092
__Pyx_GIVEREF(__pyx_t_5);
1094
__pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1095
__Pyx_GOTREF(__pyx_t_5);
1096
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1097
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1098
__pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1099
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1100
__pyx_v_power = __pyx_t_6;
1102
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":20
1104
* power = sqrt(s_prev2**2 + s_prev**2 - coeff * s_prev2 * s_prev)
1105
* return power # <<<<<<<<<<<<<<
1107
* def ipdft_inner(np.ndarray[np.float64_t, ndim=1] x,
1109
__Pyx_XDECREF(__pyx_r);
1110
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_power); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1111
__Pyx_GOTREF(__pyx_t_5);
1112
__pyx_r = __pyx_t_5;
1116
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1119
__Pyx_XDECREF(__pyx_t_1);
1120
__Pyx_XDECREF(__pyx_t_2);
1121
__Pyx_XDECREF(__pyx_t_3);
1122
__Pyx_XDECREF(__pyx_t_4);
1123
__Pyx_XDECREF(__pyx_t_5);
1124
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
1125
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
1126
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
1127
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
1128
__Pyx_AddTraceback("cogent.maths._period.goertzel_inner");
1132
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
1134
__Pyx_DECREF((PyObject *)__pyx_v_x);
1135
__Pyx_XGIVEREF(__pyx_r);
1136
__Pyx_RefNannyFinishContext();
1140
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":22
1143
* def ipdft_inner(np.ndarray[np.float64_t, ndim=1] x, # <<<<<<<<<<<<<<
1144
* np.ndarray[np.complex128_t, ndim=1] X,
1145
* np.ndarray[np.complex128_t, ndim=1] W,
1148
static PyObject *__pyx_pf_6cogent_5maths_7_period_ipdft_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1149
static char __pyx_doc_6cogent_5maths_7_period_ipdft_inner[] = "use this when repeated calls for window of same length are to be\n made";
1150
static PyObject *__pyx_pf_6cogent_5maths_7_period_ipdft_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1151
PyArrayObject *__pyx_v_x = 0;
1152
PyArrayObject *__pyx_v_X = 0;
1153
PyArrayObject *__pyx_v_W = 0;
1158
__pyx_t_double_complex __pyx_v_w;
1159
Py_buffer __pyx_bstruct_X;
1160
Py_ssize_t __pyx_bstride_0_X = 0;
1161
Py_ssize_t __pyx_bshape_0_X = 0;
1162
Py_buffer __pyx_bstruct_W;
1163
Py_ssize_t __pyx_bstride_0_W = 0;
1164
Py_ssize_t __pyx_bshape_0_W = 0;
1165
Py_buffer __pyx_bstruct_x;
1166
Py_ssize_t __pyx_bstride_0_x = 0;
1167
Py_ssize_t __pyx_bshape_0_x = 0;
1168
PyObject *__pyx_r = NULL;
1178
__pyx_t_npy_float64_complex __pyx_t_10;
1180
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__X,&__pyx_n_s__W,&__pyx_n_s__ulim,&__pyx_n_s__N,0};
1181
__Pyx_RefNannySetupContext("ipdft_inner");
1182
__pyx_self = __pyx_self;
1183
if (unlikely(__pyx_kwds)) {
1184
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1185
PyObject* values[5] = {0,0,0,0,0};
1186
switch (PyTuple_GET_SIZE(__pyx_args)) {
1187
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
1188
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1189
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1190
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1191
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1193
default: goto __pyx_L5_argtuple_error;
1195
switch (PyTuple_GET_SIZE(__pyx_args)) {
1197
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
1198
if (likely(values[0])) kw_args--;
1199
else goto __pyx_L5_argtuple_error;
1201
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X);
1202
if (likely(values[1])) kw_args--;
1204
__Pyx_RaiseArgtupleInvalid("ipdft_inner", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1207
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__W);
1208
if (likely(values[2])) kw_args--;
1210
__Pyx_RaiseArgtupleInvalid("ipdft_inner", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1213
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ulim);
1214
if (likely(values[3])) kw_args--;
1216
__Pyx_RaiseArgtupleInvalid("ipdft_inner", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1219
values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__N);
1220
if (likely(values[4])) kw_args--;
1222
__Pyx_RaiseArgtupleInvalid("ipdft_inner", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1225
if (unlikely(kw_args > 0)) {
1226
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ipdft_inner") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1228
__pyx_v_x = ((PyArrayObject *)values[0]);
1229
__pyx_v_X = ((PyArrayObject *)values[1]);
1230
__pyx_v_W = ((PyArrayObject *)values[2]);
1231
__pyx_v_ulim = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_ulim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1232
__pyx_v_N = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1233
} else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
1234
goto __pyx_L5_argtuple_error;
1236
__pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
1237
__pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
1238
__pyx_v_W = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2));
1239
__pyx_v_ulim = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_ulim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1240
__pyx_v_N = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1242
goto __pyx_L4_argument_unpacking_done;
1243
__pyx_L5_argtuple_error:;
1244
__Pyx_RaiseArgtupleInvalid("ipdft_inner", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1246
__Pyx_AddTraceback("cogent.maths._period.ipdft_inner");
1248
__pyx_L4_argument_unpacking_done:;
1249
__Pyx_INCREF((PyObject *)__pyx_v_x);
1250
__Pyx_INCREF((PyObject *)__pyx_v_X);
1251
__Pyx_INCREF((PyObject *)__pyx_v_W);
1252
__pyx_bstruct_x.buf = NULL;
1253
__pyx_bstruct_X.buf = NULL;
1254
__pyx_bstruct_W.buf = NULL;
1255
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1256
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1257
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_W), __pyx_ptype_5numpy_ndarray, 1, "W", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1259
__Pyx_BufFmt_StackElem __pyx_stack[1];
1260
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1262
__pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
1263
__pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
1265
__Pyx_BufFmt_StackElem __pyx_stack[1];
1266
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1268
__pyx_bstride_0_X = __pyx_bstruct_X.strides[0];
1269
__pyx_bshape_0_X = __pyx_bstruct_X.shape[0];
1271
__Pyx_BufFmt_StackElem __pyx_stack[1];
1272
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_W, (PyObject*)__pyx_v_W, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1274
__pyx_bstride_0_W = __pyx_bstruct_W.strides[0];
1275
__pyx_bshape_0_W = __pyx_bstruct_W.shape[0];
1277
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":31
1278
* cdef np.complex128_t w
1280
* for p in range(ulim): # <<<<<<<<<<<<<<
1282
* for n in range(N):
1284
__pyx_t_1 = __pyx_v_ulim;
1285
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
1286
__pyx_v_p = __pyx_t_2;
1288
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":32
1290
* for p in range(ulim):
1291
* w = 1.0 # <<<<<<<<<<<<<<
1292
* for n in range(N):
1295
__pyx_v_w = __pyx_t_double_complex_from_parts(1.0, 0);
1297
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":33
1298
* for p in range(ulim):
1300
* for n in range(N): # <<<<<<<<<<<<<<
1304
__pyx_t_3 = __pyx_v_N;
1305
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
1306
__pyx_v_n = __pyx_t_4;
1308
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":34
1310
* for n in range(N):
1311
* if n != 0: # <<<<<<<<<<<<<<
1313
* X[p] = X[p] + x[n]*w
1315
__pyx_t_5 = (__pyx_v_n != 0);
1318
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":35
1319
* for n in range(N):
1321
* w = w * W[p] # <<<<<<<<<<<<<<
1322
* X[p] = X[p] + x[n]*w
1325
__pyx_t_6 = __pyx_v_p;
1327
if (__pyx_t_6 < 0) {
1328
__pyx_t_6 += __pyx_bshape_0_W;
1329
if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 0;
1330
} else if (unlikely(__pyx_t_6 >= __pyx_bshape_0_W)) __pyx_t_7 = 0;
1331
if (unlikely(__pyx_t_7 != -1)) {
1332
__Pyx_RaiseBufferIndexError(__pyx_t_7);
1333
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1335
__pyx_v_w = __Pyx_c_prod(__pyx_v_w, (*__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_bstruct_W.buf, __pyx_t_6, __pyx_bstride_0_W)));
1340
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":36
1343
* X[p] = X[p] + x[n]*w # <<<<<<<<<<<<<<
1347
__pyx_t_7 = __pyx_v_p;
1349
if (__pyx_t_7 < 0) {
1350
__pyx_t_7 += __pyx_bshape_0_X;
1351
if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
1352
} else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_X)) __pyx_t_8 = 0;
1353
if (unlikely(__pyx_t_8 != -1)) {
1354
__Pyx_RaiseBufferIndexError(__pyx_t_8);
1355
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1357
__pyx_t_8 = __pyx_v_n;
1359
if (__pyx_t_8 < 0) {
1360
__pyx_t_8 += __pyx_bshape_0_x;
1361
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
1362
} else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_x)) __pyx_t_9 = 0;
1363
if (unlikely(__pyx_t_9 != -1)) {
1364
__Pyx_RaiseBufferIndexError(__pyx_t_9);
1365
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1367
__pyx_t_10 = __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex_from_parts((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_8, __pyx_bstride_0_x)), 0), __pyx_t_npy_float64_complex_from_parts(__Pyx_CREAL(__pyx_v_w), __Pyx_CIMAG(__pyx_v_w)));
1368
__pyx_t_9 = __pyx_v_p;
1370
if (__pyx_t_9 < 0) {
1371
__pyx_t_9 += __pyx_bshape_0_X;
1372
if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 0;
1373
} else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_X)) __pyx_t_11 = 0;
1374
if (unlikely(__pyx_t_11 != -1)) {
1375
__Pyx_RaiseBufferIndexError(__pyx_t_11);
1376
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1378
*__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_bstruct_X.buf, __pyx_t_9, __pyx_bstride_0_X) = __Pyx_c_sum((*__Pyx_BufPtrStrided1d(__pyx_t_double_complex *, __pyx_bstruct_X.buf, __pyx_t_7, __pyx_bstride_0_X)), __pyx_t_double_complex_from_parts(__Pyx_CREAL(__pyx_t_10), __Pyx_CIMAG(__pyx_t_10)));
1382
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":37
1384
* X[p] = X[p] + x[n]*w
1385
* return X # <<<<<<<<<<<<<<
1387
* def autocorr_inner(np.ndarray[np.float64_t, ndim=1] x, np.ndarray[np.float64_t, ndim=1] xc, int N):
1389
__Pyx_XDECREF(__pyx_r);
1390
__Pyx_INCREF(((PyObject *)__pyx_v_X));
1391
__pyx_r = ((PyObject *)__pyx_v_X);
1394
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1397
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
1398
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
1399
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_X);
1400
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_W);
1401
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
1402
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
1403
__Pyx_AddTraceback("cogent.maths._period.ipdft_inner");
1407
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_X);
1408
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_W);
1409
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
1411
__Pyx_DECREF((PyObject *)__pyx_v_x);
1412
__Pyx_DECREF((PyObject *)__pyx_v_X);
1413
__Pyx_DECREF((PyObject *)__pyx_v_W);
1414
__Pyx_XGIVEREF(__pyx_r);
1415
__Pyx_RefNannyFinishContext();
1419
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":39
1422
* def autocorr_inner(np.ndarray[np.float64_t, ndim=1] x, np.ndarray[np.float64_t, ndim=1] xc, int N): # <<<<<<<<<<<<<<
1427
static PyObject *__pyx_pf_6cogent_5maths_7_period_autocorr_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1428
static PyObject *__pyx_pf_6cogent_5maths_7_period_autocorr_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1429
PyArrayObject *__pyx_v_x = 0;
1430
PyArrayObject *__pyx_v_xc = 0;
1434
Py_buffer __pyx_bstruct_x;
1435
Py_ssize_t __pyx_bstride_0_x = 0;
1436
Py_ssize_t __pyx_bshape_0_x = 0;
1437
Py_buffer __pyx_bstruct_xc;
1438
Py_ssize_t __pyx_bstride_0_xc = 0;
1439
Py_ssize_t __pyx_bshape_0_xc = 0;
1440
PyObject *__pyx_r = NULL;
1450
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__xc,&__pyx_n_s__N,0};
1451
__Pyx_RefNannySetupContext("autocorr_inner");
1452
__pyx_self = __pyx_self;
1453
if (unlikely(__pyx_kwds)) {
1454
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1455
PyObject* values[3] = {0,0,0};
1456
switch (PyTuple_GET_SIZE(__pyx_args)) {
1457
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1458
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1459
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1461
default: goto __pyx_L5_argtuple_error;
1463
switch (PyTuple_GET_SIZE(__pyx_args)) {
1465
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
1466
if (likely(values[0])) kw_args--;
1467
else goto __pyx_L5_argtuple_error;
1469
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xc);
1470
if (likely(values[1])) kw_args--;
1472
__Pyx_RaiseArgtupleInvalid("autocorr_inner", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1475
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__N);
1476
if (likely(values[2])) kw_args--;
1478
__Pyx_RaiseArgtupleInvalid("autocorr_inner", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1481
if (unlikely(kw_args > 0)) {
1482
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "autocorr_inner") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1484
__pyx_v_x = ((PyArrayObject *)values[0]);
1485
__pyx_v_xc = ((PyArrayObject *)values[1]);
1486
__pyx_v_N = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1487
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
1488
goto __pyx_L5_argtuple_error;
1490
__pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
1491
__pyx_v_xc = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1));
1492
__pyx_v_N = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1494
goto __pyx_L4_argument_unpacking_done;
1495
__pyx_L5_argtuple_error:;
1496
__Pyx_RaiseArgtupleInvalid("autocorr_inner", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1498
__Pyx_AddTraceback("cogent.maths._period.autocorr_inner");
1500
__pyx_L4_argument_unpacking_done:;
1501
__Pyx_INCREF((PyObject *)__pyx_v_x);
1502
__Pyx_INCREF((PyObject *)__pyx_v_xc);
1503
__pyx_bstruct_x.buf = NULL;
1504
__pyx_bstruct_xc.buf = NULL;
1505
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1506
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xc), __pyx_ptype_5numpy_ndarray, 1, "xc", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1508
__Pyx_BufFmt_StackElem __pyx_stack[1];
1509
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1511
__pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
1512
__pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
1514
__Pyx_BufFmt_StackElem __pyx_stack[1];
1515
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xc, (PyObject*)__pyx_v_xc, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1517
__pyx_bstride_0_xc = __pyx_bstruct_xc.strides[0];
1518
__pyx_bshape_0_xc = __pyx_bstruct_xc.shape[0];
1520
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":42
1523
* for m in range(-N+1, N): # <<<<<<<<<<<<<<
1524
* for n in range(N):
1527
__pyx_t_1 = __pyx_v_N;
1528
for (__pyx_t_2 = ((-__pyx_v_N) + 1); __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
1529
__pyx_v_m = __pyx_t_2;
1531
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":43
1533
* for m in range(-N+1, N):
1534
* for n in range(N): # <<<<<<<<<<<<<<
1536
* xc[m+N-1] += (x[n]*x[n-m])
1538
__pyx_t_3 = __pyx_v_N;
1539
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
1540
__pyx_v_n = __pyx_t_4;
1542
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":44
1543
* for m in range(-N+1, N):
1544
* for n in range(N):
1545
* if 0 <= n-m < N: # <<<<<<<<<<<<<<
1546
* xc[m+N-1] += (x[n]*x[n-m])
1549
__pyx_t_5 = (__pyx_v_n - __pyx_v_m);
1550
__pyx_t_6 = (0 <= __pyx_t_5);
1552
__pyx_t_6 = (__pyx_t_5 < __pyx_v_N);
1556
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":45
1557
* for n in range(N):
1559
* xc[m+N-1] += (x[n]*x[n-m]) # <<<<<<<<<<<<<<
1561
* def seq_to_symbols(char* seq, list motifs, int motif_length,
1563
__pyx_t_5 = __pyx_v_n;
1565
if (__pyx_t_5 < 0) {
1566
__pyx_t_5 += __pyx_bshape_0_x;
1567
if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
1568
} else if (unlikely(__pyx_t_5 >= __pyx_bshape_0_x)) __pyx_t_7 = 0;
1569
if (unlikely(__pyx_t_7 != -1)) {
1570
__Pyx_RaiseBufferIndexError(__pyx_t_7);
1571
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1573
__pyx_t_7 = (__pyx_v_n - __pyx_v_m);
1575
if (__pyx_t_7 < 0) {
1576
__pyx_t_7 += __pyx_bshape_0_x;
1577
if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
1578
} else if (unlikely(__pyx_t_7 >= __pyx_bshape_0_x)) __pyx_t_8 = 0;
1579
if (unlikely(__pyx_t_8 != -1)) {
1580
__Pyx_RaiseBufferIndexError(__pyx_t_8);
1581
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1583
__pyx_t_9 = ((__pyx_v_m + __pyx_v_N) - 1);
1585
if (__pyx_t_9 < 0) {
1586
__pyx_t_9 += __pyx_bshape_0_xc;
1587
if (unlikely(__pyx_t_9 < 0)) __pyx_t_8 = 0;
1588
} else if (unlikely(__pyx_t_9 >= __pyx_bshape_0_xc)) __pyx_t_8 = 0;
1589
if (unlikely(__pyx_t_8 != -1)) {
1590
__Pyx_RaiseBufferIndexError(__pyx_t_8);
1591
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1593
*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_xc.buf, __pyx_t_9, __pyx_bstride_0_xc) += ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_5, __pyx_bstride_0_x)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_7, __pyx_bstride_0_x)));
1600
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1603
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
1604
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
1605
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
1606
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_xc);
1607
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
1608
__Pyx_AddTraceback("cogent.maths._period.autocorr_inner");
1612
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_x);
1613
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_xc);
1615
__Pyx_DECREF((PyObject *)__pyx_v_x);
1616
__Pyx_DECREF((PyObject *)__pyx_v_xc);
1617
__Pyx_XGIVEREF(__pyx_r);
1618
__Pyx_RefNannyFinishContext();
1622
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":47
1623
* xc[m+N-1] += (x[n]*x[n-m])
1625
* def seq_to_symbols(char* seq, list motifs, int motif_length, # <<<<<<<<<<<<<<
1626
* np.ndarray[np.uint8_t, ndim=1] result):
1627
* cdef int i, j, N, num_motifs
1630
static PyObject *__pyx_pf_6cogent_5maths_7_period_seq_to_symbols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1631
static PyObject *__pyx_pf_6cogent_5maths_7_period_seq_to_symbols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1633
PyObject *__pyx_v_motifs = 0;
1634
int __pyx_v_motif_length;
1635
PyArrayObject *__pyx_v_result = 0;
1639
int __pyx_v_num_motifs;
1640
PyObject *__pyx_v_got;
1641
Py_buffer __pyx_bstruct_result;
1642
Py_ssize_t __pyx_bstride_0_result = 0;
1643
Py_ssize_t __pyx_bshape_0_result = 0;
1644
PyObject *__pyx_r = NULL;
1646
Py_ssize_t __pyx_t_2;
1647
PyObject *__pyx_t_3 = NULL;
1652
PyObject *__pyx_t_8 = NULL;
1656
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seq,&__pyx_n_s__motifs,&__pyx_n_s__motif_length,&__pyx_n_s__result,0};
1657
__Pyx_RefNannySetupContext("seq_to_symbols");
1658
__pyx_self = __pyx_self;
1659
if (unlikely(__pyx_kwds)) {
1660
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
1661
PyObject* values[4] = {0,0,0,0};
1662
switch (PyTuple_GET_SIZE(__pyx_args)) {
1663
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
1664
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
1665
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1666
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1668
default: goto __pyx_L5_argtuple_error;
1670
switch (PyTuple_GET_SIZE(__pyx_args)) {
1672
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq);
1673
if (likely(values[0])) kw_args--;
1674
else goto __pyx_L5_argtuple_error;
1676
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__motifs);
1677
if (likely(values[1])) kw_args--;
1679
__Pyx_RaiseArgtupleInvalid("seq_to_symbols", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1682
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__motif_length);
1683
if (likely(values[2])) kw_args--;
1685
__Pyx_RaiseArgtupleInvalid("seq_to_symbols", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1688
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result);
1689
if (likely(values[3])) kw_args--;
1691
__Pyx_RaiseArgtupleInvalid("seq_to_symbols", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1694
if (unlikely(kw_args > 0)) {
1695
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seq_to_symbols") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1697
__pyx_v_seq = __Pyx_PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_seq) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1698
__pyx_v_motifs = ((PyObject *)values[1]);
1699
__pyx_v_motif_length = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_motif_length == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1700
__pyx_v_result = ((PyArrayObject *)values[3]);
1701
} else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
1702
goto __pyx_L5_argtuple_error;
1704
__pyx_v_seq = __Pyx_PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_seq) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1705
__pyx_v_motifs = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
1706
__pyx_v_motif_length = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_motif_length == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1707
__pyx_v_result = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3));
1709
goto __pyx_L4_argument_unpacking_done;
1710
__pyx_L5_argtuple_error:;
1711
__Pyx_RaiseArgtupleInvalid("seq_to_symbols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
1713
__Pyx_AddTraceback("cogent.maths._period.seq_to_symbols");
1715
__pyx_L4_argument_unpacking_done:;
1716
__Pyx_INCREF(__pyx_v_motifs);
1717
__Pyx_INCREF((PyObject *)__pyx_v_result);
1718
__pyx_v_got = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
1719
__pyx_bstruct_result.buf = NULL;
1720
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_motifs), &PyList_Type, 1, "motifs", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1721
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_result), __pyx_ptype_5numpy_ndarray, 1, "result", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1723
__Pyx_BufFmt_StackElem __pyx_stack[1];
1724
if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1726
__pyx_bstride_0_result = __pyx_bstruct_result.strides[0];
1727
__pyx_bshape_0_result = __pyx_bstruct_result.shape[0];
1729
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":52
1732
* N = len(seq) # <<<<<<<<<<<<<<
1733
* num_motifs = len(motifs)
1734
* motif_length = len(motifs[0])
1736
__pyx_t_1 = strlen(__pyx_v_seq);
1737
__pyx_v_N = __pyx_t_1;
1739
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":53
1742
* num_motifs = len(motifs) # <<<<<<<<<<<<<<
1743
* motif_length = len(motifs[0])
1744
* for i in range(N - motif_length + 1):
1746
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_motifs)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1747
__pyx_v_num_motifs = __pyx_t_2;
1749
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":54
1751
* num_motifs = len(motifs)
1752
* motif_length = len(motifs[0]) # <<<<<<<<<<<<<<
1753
* for i in range(N - motif_length + 1):
1754
* got = seq[i: i+motif_length]
1756
__pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_motifs), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1757
__Pyx_GOTREF(__pyx_t_3);
1758
__pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1759
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1760
__pyx_v_motif_length = __pyx_t_2;
1762
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":55
1763
* num_motifs = len(motifs)
1764
* motif_length = len(motifs[0])
1765
* for i in range(N - motif_length + 1): # <<<<<<<<<<<<<<
1766
* got = seq[i: i+motif_length]
1767
* for j in range(num_motifs):
1769
__pyx_t_4 = ((__pyx_v_N - __pyx_v_motif_length) + 1);
1770
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
1771
__pyx_v_i = __pyx_t_5;
1773
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":56
1774
* motif_length = len(motifs[0])
1775
* for i in range(N - motif_length + 1):
1776
* got = seq[i: i+motif_length] # <<<<<<<<<<<<<<
1777
* for j in range(num_motifs):
1778
* if got == motifs[j]:
1780
__pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_seq + __pyx_v_i, (__pyx_v_i + __pyx_v_motif_length) - __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1781
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
1782
__Pyx_DECREF(((PyObject *)__pyx_v_got));
1783
__pyx_v_got = __pyx_t_3;
1786
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":57
1787
* for i in range(N - motif_length + 1):
1788
* got = seq[i: i+motif_length]
1789
* for j in range(num_motifs): # <<<<<<<<<<<<<<
1790
* if got == motifs[j]:
1793
__pyx_t_6 = __pyx_v_num_motifs;
1794
for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
1795
__pyx_v_j = __pyx_t_7;
1797
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":58
1798
* got = seq[i: i+motif_length]
1799
* for j in range(num_motifs):
1800
* if got == motifs[j]: # <<<<<<<<<<<<<<
1804
__pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_motifs), __pyx_v_j, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1805
__Pyx_GOTREF(__pyx_t_3);
1806
__pyx_t_8 = PyObject_RichCompare(((PyObject *)__pyx_v_got), __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1807
__Pyx_GOTREF(__pyx_t_8);
1808
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1809
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1810
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
1813
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":59
1814
* for j in range(num_motifs):
1815
* if got == motifs[j]:
1816
* result[i] = 1 # <<<<<<<<<<<<<<
1820
__pyx_t_10 = __pyx_v_i;
1822
if (__pyx_t_10 < 0) {
1823
__pyx_t_10 += __pyx_bshape_0_result;
1824
if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
1825
} else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_result)) __pyx_t_11 = 0;
1826
if (unlikely(__pyx_t_11 != -1)) {
1827
__Pyx_RaiseBufferIndexError(__pyx_t_11);
1828
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1830
*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_bstruct_result.buf, __pyx_t_10, __pyx_bstride_0_result) = 1;
1837
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":60
1838
* if got == motifs[j]:
1840
* return result # <<<<<<<<<<<<<<
1843
__Pyx_XDECREF(__pyx_r);
1844
__Pyx_INCREF(((PyObject *)__pyx_v_result));
1845
__pyx_r = ((PyObject *)__pyx_v_result);
1848
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
1851
__Pyx_XDECREF(__pyx_t_3);
1852
__Pyx_XDECREF(__pyx_t_8);
1853
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
1854
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
1855
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
1856
__Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
1857
__Pyx_AddTraceback("cogent.maths._period.seq_to_symbols");
1861
__Pyx_SafeReleaseBuffer(&__pyx_bstruct_result);
1863
__Pyx_DECREF(__pyx_v_got);
1864
__Pyx_DECREF(__pyx_v_motifs);
1865
__Pyx_DECREF((PyObject *)__pyx_v_result);
1866
__Pyx_XGIVEREF(__pyx_r);
1867
__Pyx_RefNannyFinishContext();
1871
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":187
1872
* # experimental exception made for __getbuffer__ and __releasebuffer__
1873
* # -- the details of this may change.
1874
* def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
1875
* # This implementation of getbuffer is geared towards Cython
1876
* # requirements, and does not yet fullfill the PEP.
1879
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1880
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
1881
int __pyx_v_copy_shape;
1884
int __pyx_v_endian_detector;
1885
int __pyx_v_little_endian;
1888
PyArray_Descr *__pyx_v_descr = 0;
1890
int __pyx_v_hasfields;
1895
PyObject *__pyx_t_4 = NULL;
1896
PyObject *__pyx_t_5 = NULL;
1901
__Pyx_RefNannySetupContext("__getbuffer__");
1902
if (__pyx_v_info == NULL) return 0;
1903
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
1904
__Pyx_GIVEREF(__pyx_v_info->obj);
1905
__Pyx_INCREF((PyObject *)__pyx_v_self);
1907
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":193
1909
* cdef int copy_shape, i, ndim
1910
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
1911
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
1914
__pyx_v_endian_detector = 1;
1916
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":194
1917
* cdef int copy_shape, i, ndim
1918
* cdef int endian_detector = 1
1919
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
1921
* ndim = PyArray_NDIM(self)
1923
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
1925
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":196
1926
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
1928
* ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
1930
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
1932
__pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));
1934
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":198
1935
* ndim = PyArray_NDIM(self)
1937
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
1941
__pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
1944
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":199
1946
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
1947
* copy_shape = 1 # <<<<<<<<<<<<<<
1951
__pyx_v_copy_shape = 1;
1956
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":201
1959
* copy_shape = 0 # <<<<<<<<<<<<<<
1961
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
1963
__pyx_v_copy_shape = 0;
1967
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":203
1970
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
1971
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
1972
* raise ValueError(u"ndarray is not C contiguous")
1974
__pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
1977
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":204
1979
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
1980
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
1981
* raise ValueError(u"ndarray is not C contiguous")
1984
__pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
1985
__pyx_t_3 = __pyx_t_2;
1987
__pyx_t_3 = __pyx_t_1;
1991
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":205
1992
* if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
1993
* and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
1994
* raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
1996
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
1998
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1999
__Pyx_GOTREF(__pyx_t_4);
2000
__Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
2001
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1));
2002
__Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
2003
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2004
__Pyx_GOTREF(__pyx_t_5);
2005
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2006
__Pyx_Raise(__pyx_t_5, 0, 0);
2007
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2008
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2013
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":207
2014
* raise ValueError(u"ndarray is not C contiguous")
2016
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
2017
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
2018
* raise ValueError(u"ndarray is not Fortran contiguous")
2020
__pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
2023
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":208
2025
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2026
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
2027
* raise ValueError(u"ndarray is not Fortran contiguous")
2030
__pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
2031
__pyx_t_2 = __pyx_t_1;
2033
__pyx_t_2 = __pyx_t_3;
2037
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":209
2038
* if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
2039
* and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
2040
* raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
2042
* info.buf = PyArray_DATA(self)
2044
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2045
__Pyx_GOTREF(__pyx_t_5);
2046
__Pyx_INCREF(((PyObject *)__pyx_kp_u_2));
2047
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2));
2048
__Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2));
2049
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2050
__Pyx_GOTREF(__pyx_t_4);
2051
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2052
__Pyx_Raise(__pyx_t_4, 0, 0);
2053
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2054
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2059
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":211
2060
* raise ValueError(u"ndarray is not Fortran contiguous")
2062
* info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
2066
__pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));
2068
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":212
2070
* info.buf = PyArray_DATA(self)
2071
* info.ndim = ndim # <<<<<<<<<<<<<<
2073
* # Allocate new buffer for strides and shape info. This is allocated
2075
__pyx_v_info->ndim = __pyx_v_ndim;
2077
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":213
2078
* info.buf = PyArray_DATA(self)
2080
* if copy_shape: # <<<<<<<<<<<<<<
2081
* # Allocate new buffer for strides and shape info. This is allocated
2082
* # as one block, strides first.
2084
__pyx_t_6 = __pyx_v_copy_shape;
2087
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":216
2088
* # Allocate new buffer for strides and shape info. This is allocated
2089
* # as one block, strides first.
2090
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<<
2091
* info.shape = info.strides + ndim
2092
* for i in range(ndim):
2094
__pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));
2096
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":217
2097
* # as one block, strides first.
2098
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
2099
* info.shape = info.strides + ndim # <<<<<<<<<<<<<<
2100
* for i in range(ndim):
2101
* info.strides[i] = PyArray_STRIDES(self)[i]
2103
__pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
2105
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":218
2106
* info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
2107
* info.shape = info.strides + ndim
2108
* for i in range(ndim): # <<<<<<<<<<<<<<
2109
* info.strides[i] = PyArray_STRIDES(self)[i]
2110
* info.shape[i] = PyArray_DIMS(self)[i]
2112
__pyx_t_6 = __pyx_v_ndim;
2113
for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
2114
__pyx_v_i = __pyx_t_7;
2116
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":219
2117
* info.shape = info.strides + ndim
2118
* for i in range(ndim):
2119
* info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
2120
* info.shape[i] = PyArray_DIMS(self)[i]
2123
(__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
2125
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":220
2126
* for i in range(ndim):
2127
* info.strides[i] = PyArray_STRIDES(self)[i]
2128
* info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
2130
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2132
(__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
2138
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":222
2139
* info.shape[i] = PyArray_DIMS(self)[i]
2141
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
2142
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2143
* info.suboffsets = NULL
2145
__pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));
2147
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":223
2149
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2150
* info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
2151
* info.suboffsets = NULL
2152
* info.itemsize = PyArray_ITEMSIZE(self)
2154
__pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
2158
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":224
2159
* info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
2160
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2161
* info.suboffsets = NULL # <<<<<<<<<<<<<<
2162
* info.itemsize = PyArray_ITEMSIZE(self)
2163
* info.readonly = not PyArray_ISWRITEABLE(self)
2165
__pyx_v_info->suboffsets = NULL;
2167
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":225
2168
* info.shape = <Py_ssize_t*>PyArray_DIMS(self)
2169
* info.suboffsets = NULL
2170
* info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
2171
* info.readonly = not PyArray_ISWRITEABLE(self)
2174
__pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));
2176
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":226
2177
* info.suboffsets = NULL
2178
* info.itemsize = PyArray_ITEMSIZE(self)
2179
* info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
2183
__pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));
2185
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":229
2188
* cdef char* f = NULL # <<<<<<<<<<<<<<
2189
* cdef dtype descr = self.descr
2194
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":230
2196
* cdef char* f = NULL
2197
* cdef dtype descr = self.descr # <<<<<<<<<<<<<<
2201
__Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
2202
__pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;
2204
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":234
2207
* cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
2209
* if not hasfields and not copy_shape:
2211
__pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
2213
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":236
2214
* cdef bint hasfields = PyDataType_HASFIELDS(descr)
2216
* if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
2217
* # do not call releasebuffer
2220
__pyx_t_2 = (!__pyx_v_hasfields);
2222
__pyx_t_3 = (!__pyx_v_copy_shape);
2223
__pyx_t_1 = __pyx_t_3;
2225
__pyx_t_1 = __pyx_t_2;
2229
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":238
2230
* if not hasfields and not copy_shape:
2231
* # do not call releasebuffer
2232
* info.obj = None # <<<<<<<<<<<<<<
2234
* # need to call releasebuffer
2236
__Pyx_INCREF(Py_None);
2237
__Pyx_GIVEREF(Py_None);
2238
__Pyx_GOTREF(__pyx_v_info->obj);
2239
__Pyx_DECREF(__pyx_v_info->obj);
2240
__pyx_v_info->obj = Py_None;
2245
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":241
2247
* # need to call releasebuffer
2248
* info.obj = self # <<<<<<<<<<<<<<
2252
__Pyx_INCREF(__pyx_v_self);
2253
__Pyx_GIVEREF(__pyx_v_self);
2254
__Pyx_GOTREF(__pyx_v_info->obj);
2255
__Pyx_DECREF(__pyx_v_info->obj);
2256
__pyx_v_info->obj = __pyx_v_self;
2260
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":243
2263
* if not hasfields: # <<<<<<<<<<<<<<
2264
* t = descr.type_num
2265
* if ((descr.byteorder == '>' and little_endian) or
2267
__pyx_t_1 = (!__pyx_v_hasfields);
2270
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":244
2273
* t = descr.type_num # <<<<<<<<<<<<<<
2274
* if ((descr.byteorder == '>' and little_endian) or
2275
* (descr.byteorder == '<' and not little_endian)):
2277
__pyx_v_t = __pyx_v_descr->type_num;
2279
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":245
2281
* t = descr.type_num
2282
* if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<<
2283
* (descr.byteorder == '<' and not little_endian)):
2284
* raise ValueError(u"Non-native byte order not supported")
2286
__pyx_t_1 = (__pyx_v_descr->byteorder == '>');
2288
__pyx_t_2 = __pyx_v_little_endian;
2290
__pyx_t_2 = __pyx_t_1;
2294
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":246
2295
* t = descr.type_num
2296
* if ((descr.byteorder == '>' and little_endian) or
2297
* (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<<
2298
* raise ValueError(u"Non-native byte order not supported")
2299
* if t == NPY_BYTE: f = "b"
2301
__pyx_t_1 = (__pyx_v_descr->byteorder == '<');
2303
__pyx_t_3 = (!__pyx_v_little_endian);
2304
__pyx_t_8 = __pyx_t_3;
2306
__pyx_t_8 = __pyx_t_1;
2308
__pyx_t_1 = __pyx_t_8;
2310
__pyx_t_1 = __pyx_t_2;
2314
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":247
2315
* if ((descr.byteorder == '>' and little_endian) or
2316
* (descr.byteorder == '<' and not little_endian)):
2317
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
2318
* if t == NPY_BYTE: f = "b"
2319
* elif t == NPY_UBYTE: f = "B"
2321
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2322
__Pyx_GOTREF(__pyx_t_4);
2323
__Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
2324
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3));
2325
__Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
2326
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2327
__Pyx_GOTREF(__pyx_t_5);
2328
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2329
__Pyx_Raise(__pyx_t_5, 0, 0);
2330
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2331
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2336
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":248
2337
* (descr.byteorder == '<' and not little_endian)):
2338
* raise ValueError(u"Non-native byte order not supported")
2339
* if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
2340
* elif t == NPY_UBYTE: f = "B"
2341
* elif t == NPY_SHORT: f = "h"
2343
__pyx_t_1 = (__pyx_v_t == NPY_BYTE);
2345
__pyx_v_f = __pyx_k__b;
2349
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":249
2350
* raise ValueError(u"Non-native byte order not supported")
2351
* if t == NPY_BYTE: f = "b"
2352
* elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
2353
* elif t == NPY_SHORT: f = "h"
2354
* elif t == NPY_USHORT: f = "H"
2356
__pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
2358
__pyx_v_f = __pyx_k__B;
2362
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":250
2363
* if t == NPY_BYTE: f = "b"
2364
* elif t == NPY_UBYTE: f = "B"
2365
* elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
2366
* elif t == NPY_USHORT: f = "H"
2367
* elif t == NPY_INT: f = "i"
2369
__pyx_t_1 = (__pyx_v_t == NPY_SHORT);
2371
__pyx_v_f = __pyx_k__h;
2375
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":251
2376
* elif t == NPY_UBYTE: f = "B"
2377
* elif t == NPY_SHORT: f = "h"
2378
* elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
2379
* elif t == NPY_INT: f = "i"
2380
* elif t == NPY_UINT: f = "I"
2382
__pyx_t_1 = (__pyx_v_t == NPY_USHORT);
2384
__pyx_v_f = __pyx_k__H;
2388
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":252
2389
* elif t == NPY_SHORT: f = "h"
2390
* elif t == NPY_USHORT: f = "H"
2391
* elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
2392
* elif t == NPY_UINT: f = "I"
2393
* elif t == NPY_LONG: f = "l"
2395
__pyx_t_1 = (__pyx_v_t == NPY_INT);
2397
__pyx_v_f = __pyx_k__i;
2401
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":253
2402
* elif t == NPY_USHORT: f = "H"
2403
* elif t == NPY_INT: f = "i"
2404
* elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
2405
* elif t == NPY_LONG: f = "l"
2406
* elif t == NPY_ULONG: f = "L"
2408
__pyx_t_1 = (__pyx_v_t == NPY_UINT);
2410
__pyx_v_f = __pyx_k__I;
2414
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":254
2415
* elif t == NPY_INT: f = "i"
2416
* elif t == NPY_UINT: f = "I"
2417
* elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
2418
* elif t == NPY_ULONG: f = "L"
2419
* elif t == NPY_LONGLONG: f = "q"
2421
__pyx_t_1 = (__pyx_v_t == NPY_LONG);
2423
__pyx_v_f = __pyx_k__l;
2427
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":255
2428
* elif t == NPY_UINT: f = "I"
2429
* elif t == NPY_LONG: f = "l"
2430
* elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
2431
* elif t == NPY_LONGLONG: f = "q"
2432
* elif t == NPY_ULONGLONG: f = "Q"
2434
__pyx_t_1 = (__pyx_v_t == NPY_ULONG);
2436
__pyx_v_f = __pyx_k__L;
2440
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":256
2441
* elif t == NPY_LONG: f = "l"
2442
* elif t == NPY_ULONG: f = "L"
2443
* elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
2444
* elif t == NPY_ULONGLONG: f = "Q"
2445
* elif t == NPY_FLOAT: f = "f"
2447
__pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
2449
__pyx_v_f = __pyx_k__q;
2453
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":257
2454
* elif t == NPY_ULONG: f = "L"
2455
* elif t == NPY_LONGLONG: f = "q"
2456
* elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
2457
* elif t == NPY_FLOAT: f = "f"
2458
* elif t == NPY_DOUBLE: f = "d"
2460
__pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
2462
__pyx_v_f = __pyx_k__Q;
2466
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":258
2467
* elif t == NPY_LONGLONG: f = "q"
2468
* elif t == NPY_ULONGLONG: f = "Q"
2469
* elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
2470
* elif t == NPY_DOUBLE: f = "d"
2471
* elif t == NPY_LONGDOUBLE: f = "g"
2473
__pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
2475
__pyx_v_f = __pyx_k__f;
2479
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":259
2480
* elif t == NPY_ULONGLONG: f = "Q"
2481
* elif t == NPY_FLOAT: f = "f"
2482
* elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
2483
* elif t == NPY_LONGDOUBLE: f = "g"
2484
* elif t == NPY_CFLOAT: f = "Zf"
2486
__pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
2488
__pyx_v_f = __pyx_k__d;
2492
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":260
2493
* elif t == NPY_FLOAT: f = "f"
2494
* elif t == NPY_DOUBLE: f = "d"
2495
* elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
2496
* elif t == NPY_CFLOAT: f = "Zf"
2497
* elif t == NPY_CDOUBLE: f = "Zd"
2499
__pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
2501
__pyx_v_f = __pyx_k__g;
2505
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":261
2506
* elif t == NPY_DOUBLE: f = "d"
2507
* elif t == NPY_LONGDOUBLE: f = "g"
2508
* elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
2509
* elif t == NPY_CDOUBLE: f = "Zd"
2510
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2512
__pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
2514
__pyx_v_f = __pyx_k__Zf;
2518
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":262
2519
* elif t == NPY_LONGDOUBLE: f = "g"
2520
* elif t == NPY_CFLOAT: f = "Zf"
2521
* elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
2522
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2523
* elif t == NPY_OBJECT: f = "O"
2525
__pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
2527
__pyx_v_f = __pyx_k__Zd;
2531
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":263
2532
* elif t == NPY_CFLOAT: f = "Zf"
2533
* elif t == NPY_CDOUBLE: f = "Zd"
2534
* elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
2535
* elif t == NPY_OBJECT: f = "O"
2538
__pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
2540
__pyx_v_f = __pyx_k__Zg;
2544
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":264
2545
* elif t == NPY_CDOUBLE: f = "Zd"
2546
* elif t == NPY_CLONGDOUBLE: f = "Zg"
2547
* elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
2549
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2551
__pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
2553
__pyx_v_f = __pyx_k__O;
2558
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":266
2559
* elif t == NPY_OBJECT: f = "O"
2561
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
2565
__pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2566
__Pyx_GOTREF(__pyx_t_5);
2567
__pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2568
__Pyx_GOTREF(__pyx_t_4);
2569
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2570
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2571
__Pyx_GOTREF(__pyx_t_5);
2572
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
2573
__Pyx_GIVEREF(__pyx_t_4);
2575
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2576
__Pyx_GOTREF(__pyx_t_4);
2577
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2578
__Pyx_Raise(__pyx_t_4, 0, 0);
2579
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2580
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2584
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":267
2586
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2587
* info.format = f # <<<<<<<<<<<<<<
2591
__pyx_v_info->format = __pyx_v_f;
2593
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":268
2594
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
2596
* return # <<<<<<<<<<<<<<
2598
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
2606
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":270
2609
* info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
2610
* info.format[0] = '^' # Native data types, manual alignment
2613
__pyx_v_info->format = ((char *)malloc(255));
2615
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":271
2617
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
2618
* info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<<
2620
* f = _util_dtypestring(descr, info.format + 1,
2622
(__pyx_v_info->format[0]) = '^';
2624
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":272
2625
* info.format = <char*>stdlib.malloc(_buffer_format_string_len)
2626
* info.format[0] = '^' # Native data types, manual alignment
2627
* offset = 0 # <<<<<<<<<<<<<<
2628
* f = _util_dtypestring(descr, info.format + 1,
2629
* info.format + _buffer_format_string_len,
2633
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":275
2634
* f = _util_dtypestring(descr, info.format + 1,
2635
* info.format + _buffer_format_string_len,
2636
* &offset) # <<<<<<<<<<<<<<
2637
* f[0] = 0 # Terminate format string
2640
__pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2641
__pyx_v_f = __pyx_t_9;
2643
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":276
2644
* info.format + _buffer_format_string_len,
2646
* f[0] = 0 # Terminate format string # <<<<<<<<<<<<<<
2648
* def __releasebuffer__(ndarray self, Py_buffer* info):
2657
__Pyx_XDECREF(__pyx_t_4);
2658
__Pyx_XDECREF(__pyx_t_5);
2659
__Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
2661
__Pyx_GOTREF(__pyx_v_info->obj);
2662
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
2665
if (__pyx_v_info->obj == Py_None) {
2666
__Pyx_GOTREF(Py_None);
2667
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
2670
__Pyx_XDECREF((PyObject *)__pyx_v_descr);
2671
__Pyx_DECREF((PyObject *)__pyx_v_self);
2672
__Pyx_RefNannyFinishContext();
2676
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":278
2677
* f[0] = 0 # Terminate format string
2679
* def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
2680
* if PyArray_HASFIELDS(self):
2681
* stdlib.free(info.format)
2684
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
2685
static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
2687
__Pyx_RefNannySetupContext("__releasebuffer__");
2688
__Pyx_INCREF((PyObject *)__pyx_v_self);
2690
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":279
2692
* def __releasebuffer__(ndarray self, Py_buffer* info):
2693
* if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
2694
* stdlib.free(info.format)
2695
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2697
__pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self));
2700
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":280
2701
* def __releasebuffer__(ndarray self, Py_buffer* info):
2702
* if PyArray_HASFIELDS(self):
2703
* stdlib.free(info.format) # <<<<<<<<<<<<<<
2704
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2705
* stdlib.free(info.strides)
2707
free(__pyx_v_info->format);
2712
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":281
2713
* if PyArray_HASFIELDS(self):
2714
* stdlib.free(info.format)
2715
* if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
2716
* stdlib.free(info.strides)
2717
* # info.shape was stored after info.strides in the same block
2719
__pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
2722
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":282
2723
* stdlib.free(info.format)
2724
* if sizeof(npy_intp) != sizeof(Py_ssize_t):
2725
* stdlib.free(info.strides) # <<<<<<<<<<<<<<
2726
* # info.shape was stored after info.strides in the same block
2729
free(__pyx_v_info->strides);
2734
__Pyx_DECREF((PyObject *)__pyx_v_self);
2735
__Pyx_RefNannyFinishContext();
2738
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":755
2739
* ctypedef npy_cdouble complex_t
2741
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
2742
* return PyArray_MultiIterNew(1, <void*>a)
2746
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
2747
PyObject *__pyx_r = NULL;
2748
PyObject *__pyx_t_1 = NULL;
2749
__Pyx_RefNannySetupContext("PyArray_MultiIterNew1");
2751
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":756
2753
* cdef inline object PyArray_MultiIterNew1(a):
2754
* return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
2756
* cdef inline object PyArray_MultiIterNew2(a, b):
2758
__Pyx_XDECREF(__pyx_r);
2759
__pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2760
__Pyx_GOTREF(__pyx_t_1);
2761
__pyx_r = __pyx_t_1;
2765
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2768
__Pyx_XDECREF(__pyx_t_1);
2769
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew1");
2772
__Pyx_XGIVEREF(__pyx_r);
2773
__Pyx_RefNannyFinishContext();
2777
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":758
2778
* return PyArray_MultiIterNew(1, <void*>a)
2780
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
2781
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
2785
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
2786
PyObject *__pyx_r = NULL;
2787
PyObject *__pyx_t_1 = NULL;
2788
__Pyx_RefNannySetupContext("PyArray_MultiIterNew2");
2790
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":759
2792
* cdef inline object PyArray_MultiIterNew2(a, b):
2793
* return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
2795
* cdef inline object PyArray_MultiIterNew3(a, b, c):
2797
__Pyx_XDECREF(__pyx_r);
2798
__pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2799
__Pyx_GOTREF(__pyx_t_1);
2800
__pyx_r = __pyx_t_1;
2804
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2807
__Pyx_XDECREF(__pyx_t_1);
2808
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew2");
2811
__Pyx_XGIVEREF(__pyx_r);
2812
__Pyx_RefNannyFinishContext();
2816
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":761
2817
* return PyArray_MultiIterNew(2, <void*>a, <void*>b)
2819
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
2820
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
2824
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
2825
PyObject *__pyx_r = NULL;
2826
PyObject *__pyx_t_1 = NULL;
2827
__Pyx_RefNannySetupContext("PyArray_MultiIterNew3");
2829
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":762
2831
* cdef inline object PyArray_MultiIterNew3(a, b, c):
2832
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
2834
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
2836
__Pyx_XDECREF(__pyx_r);
2837
__pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2838
__Pyx_GOTREF(__pyx_t_1);
2839
__pyx_r = __pyx_t_1;
2843
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2846
__Pyx_XDECREF(__pyx_t_1);
2847
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew3");
2850
__Pyx_XGIVEREF(__pyx_r);
2851
__Pyx_RefNannyFinishContext();
2855
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":764
2856
* return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
2858
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
2859
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
2863
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
2864
PyObject *__pyx_r = NULL;
2865
PyObject *__pyx_t_1 = NULL;
2866
__Pyx_RefNannySetupContext("PyArray_MultiIterNew4");
2868
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":765
2870
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
2871
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
2873
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
2875
__Pyx_XDECREF(__pyx_r);
2876
__pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2877
__Pyx_GOTREF(__pyx_t_1);
2878
__pyx_r = __pyx_t_1;
2882
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2885
__Pyx_XDECREF(__pyx_t_1);
2886
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew4");
2889
__Pyx_XGIVEREF(__pyx_r);
2890
__Pyx_RefNannyFinishContext();
2894
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":767
2895
* return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
2897
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
2898
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
2902
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
2903
PyObject *__pyx_r = NULL;
2904
PyObject *__pyx_t_1 = NULL;
2905
__Pyx_RefNannySetupContext("PyArray_MultiIterNew5");
2907
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":768
2909
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
2910
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
2912
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
2914
__Pyx_XDECREF(__pyx_r);
2915
__pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2916
__Pyx_GOTREF(__pyx_t_1);
2917
__pyx_r = __pyx_t_1;
2921
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
2924
__Pyx_XDECREF(__pyx_t_1);
2925
__Pyx_AddTraceback("numpy.PyArray_MultiIterNew5");
2928
__Pyx_XGIVEREF(__pyx_r);
2929
__Pyx_RefNannyFinishContext();
2933
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":770
2934
* return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
2936
* cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
2937
* # Recursive utility function used in __getbuffer__ to get format
2938
* # string. The new location in the format string is returned.
2941
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
2942
PyArray_Descr *__pyx_v_child;
2943
int __pyx_v_endian_detector;
2944
int __pyx_v_little_endian;
2945
PyObject *__pyx_v_fields;
2946
PyObject *__pyx_v_childname;
2947
PyObject *__pyx_v_new_offset;
2948
PyObject *__pyx_v_t;
2950
Py_ssize_t __pyx_t_1;
2951
PyObject *__pyx_t_2 = NULL;
2952
PyObject *__pyx_t_3 = NULL;
2953
PyObject *__pyx_t_4 = NULL;
2954
PyObject *__pyx_t_5 = NULL;
2960
__Pyx_RefNannySetupContext("_util_dtypestring");
2961
__Pyx_INCREF((PyObject *)__pyx_v_descr);
2962
__pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
2963
__pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
2964
__pyx_v_childname = Py_None; __Pyx_INCREF(Py_None);
2965
__pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None);
2966
__pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
2968
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":777
2969
* cdef int delta_offset
2971
* cdef int endian_detector = 1 # <<<<<<<<<<<<<<
2972
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
2975
__pyx_v_endian_detector = 1;
2977
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":778
2979
* cdef int endian_detector = 1
2980
* cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
2984
__pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
2986
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":781
2989
* for childname in descr.names: # <<<<<<<<<<<<<<
2990
* fields = descr.fields[childname]
2991
* child, new_offset = fields
2993
if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) {
2994
__pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2);
2996
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2999
if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
3000
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
3001
__Pyx_DECREF(__pyx_v_childname);
3002
__pyx_v_childname = __pyx_t_3;
3005
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":782
3007
* for childname in descr.names:
3008
* fields = descr.fields[childname] # <<<<<<<<<<<<<<
3009
* child, new_offset = fields
3012
__pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3013
__Pyx_GOTREF(__pyx_t_3);
3014
if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3015
__Pyx_DECREF(((PyObject *)__pyx_v_fields));
3016
__pyx_v_fields = ((PyObject *)__pyx_t_3);
3019
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":783
3020
* for childname in descr.names:
3021
* fields = descr.fields[childname]
3022
* child, new_offset = fields # <<<<<<<<<<<<<<
3024
* if (end - f) - (new_offset - offset[0]) < 15:
3026
if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) {
3027
PyObject* tuple = ((PyObject *)__pyx_v_fields);
3028
__pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
3029
if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3030
__pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
3031
__Pyx_DECREF(((PyObject *)__pyx_v_child));
3032
__pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
3034
__Pyx_DECREF(__pyx_v_new_offset);
3035
__pyx_v_new_offset = __pyx_t_4;
3038
__Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
3039
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3042
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":785
3043
* child, new_offset = fields
3045
* if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
3046
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3049
__pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3050
__Pyx_GOTREF(__pyx_t_4);
3051
__pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3052
__Pyx_GOTREF(__pyx_t_3);
3053
__pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3054
__Pyx_GOTREF(__pyx_t_5);
3055
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3056
__pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3057
__Pyx_GOTREF(__pyx_t_3);
3058
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3059
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3060
__pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3061
__Pyx_GOTREF(__pyx_t_5);
3062
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3063
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3064
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3067
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":786
3069
* if (end - f) - (new_offset - offset[0]) < 15:
3070
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
3072
* if ((child.byteorder == '>' and little_endian) or
3074
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3075
__Pyx_GOTREF(__pyx_t_5);
3076
__Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
3077
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5));
3078
__Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
3079
__pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3080
__Pyx_GOTREF(__pyx_t_3);
3081
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3082
__Pyx_Raise(__pyx_t_3, 0, 0);
3083
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3084
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3089
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":788
3090
* raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
3092
* if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<<
3093
* (child.byteorder == '<' and not little_endian)):
3094
* raise ValueError(u"Non-native byte order not supported")
3096
__pyx_t_6 = (__pyx_v_child->byteorder == '>');
3098
__pyx_t_7 = __pyx_v_little_endian;
3100
__pyx_t_7 = __pyx_t_6;
3104
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":789
3106
* if ((child.byteorder == '>' and little_endian) or
3107
* (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<<
3108
* raise ValueError(u"Non-native byte order not supported")
3109
* # One could encode it in the format string and have Cython
3111
__pyx_t_6 = (__pyx_v_child->byteorder == '<');
3113
__pyx_t_8 = (!__pyx_v_little_endian);
3114
__pyx_t_9 = __pyx_t_8;
3116
__pyx_t_9 = __pyx_t_6;
3118
__pyx_t_6 = __pyx_t_9;
3120
__pyx_t_6 = __pyx_t_7;
3124
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":790
3125
* if ((child.byteorder == '>' and little_endian) or
3126
* (child.byteorder == '<' and not little_endian)):
3127
* raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
3128
* # One could encode it in the format string and have Cython
3129
* # complain instead, BUT: < and > in format strings also imply
3131
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3132
__Pyx_GOTREF(__pyx_t_3);
3133
__Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
3134
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3));
3135
__Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
3136
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3137
__Pyx_GOTREF(__pyx_t_5);
3138
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3139
__Pyx_Raise(__pyx_t_5, 0, 0);
3140
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3141
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3146
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":800
3148
* # Output padding bytes
3149
* while offset[0] < new_offset: # <<<<<<<<<<<<<<
3150
* f[0] = 120 # "x"; pad byte
3154
__pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3155
__Pyx_GOTREF(__pyx_t_5);
3156
__pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3157
__Pyx_GOTREF(__pyx_t_3);
3158
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3159
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3160
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3161
if (!__pyx_t_6) break;
3163
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":801
3164
* # Output padding bytes
3165
* while offset[0] < new_offset:
3166
* f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
3170
(__pyx_v_f[0]) = 120;
3172
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":802
3173
* while offset[0] < new_offset:
3174
* f[0] = 120 # "x"; pad byte
3175
* f += 1 # <<<<<<<<<<<<<<
3181
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":803
3182
* f[0] = 120 # "x"; pad byte
3184
* offset[0] += 1 # <<<<<<<<<<<<<<
3186
* offset[0] += child.itemsize
3188
(__pyx_v_offset[0]) += 1;
3191
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":805
3194
* offset[0] += child.itemsize # <<<<<<<<<<<<<<
3196
* if not PyDataType_HASFIELDS(child):
3198
(__pyx_v_offset[0]) += __pyx_v_child->elsize;
3200
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":807
3201
* offset[0] += child.itemsize
3203
* if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
3204
* t = child.type_num
3207
__pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child));
3210
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":808
3212
* if not PyDataType_HASFIELDS(child):
3213
* t = child.type_num # <<<<<<<<<<<<<<
3215
* raise RuntimeError(u"Format string allocated too short.")
3217
__pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3218
__Pyx_GOTREF(__pyx_t_3);
3219
__Pyx_DECREF(__pyx_v_t);
3220
__pyx_v_t = __pyx_t_3;
3223
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":809
3224
* if not PyDataType_HASFIELDS(child):
3225
* t = child.type_num
3226
* if end - f < 5: # <<<<<<<<<<<<<<
3227
* raise RuntimeError(u"Format string allocated too short.")
3230
__pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5);
3233
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":810
3234
* t = child.type_num
3236
* raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
3238
* # Until ticket #99 is fixed, use integers to avoid warnings
3240
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3241
__Pyx_GOTREF(__pyx_t_3);
3242
__Pyx_INCREF(((PyObject *)__pyx_kp_u_6));
3243
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6));
3244
__Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6));
3245
__pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3246
__Pyx_GOTREF(__pyx_t_5);
3247
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3248
__Pyx_Raise(__pyx_t_5, 0, 0);
3249
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3250
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3255
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":813
3257
* # Until ticket #99 is fixed, use integers to avoid warnings
3258
* if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
3259
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3260
* elif t == NPY_SHORT: f[0] = 104 #"h"
3262
__pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3263
__Pyx_GOTREF(__pyx_t_5);
3264
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3265
__Pyx_GOTREF(__pyx_t_3);
3266
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3267
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3268
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3270
(__pyx_v_f[0]) = 98;
3274
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":814
3275
* # Until ticket #99 is fixed, use integers to avoid warnings
3276
* if t == NPY_BYTE: f[0] = 98 #"b"
3277
* elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
3278
* elif t == NPY_SHORT: f[0] = 104 #"h"
3279
* elif t == NPY_USHORT: f[0] = 72 #"H"
3281
__pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3282
__Pyx_GOTREF(__pyx_t_3);
3283
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3284
__Pyx_GOTREF(__pyx_t_5);
3285
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3286
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3287
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3289
(__pyx_v_f[0]) = 66;
3293
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":815
3294
* if t == NPY_BYTE: f[0] = 98 #"b"
3295
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3296
* elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
3297
* elif t == NPY_USHORT: f[0] = 72 #"H"
3298
* elif t == NPY_INT: f[0] = 105 #"i"
3300
__pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3301
__Pyx_GOTREF(__pyx_t_5);
3302
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3303
__Pyx_GOTREF(__pyx_t_3);
3304
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3305
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3306
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3308
(__pyx_v_f[0]) = 104;
3312
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":816
3313
* elif t == NPY_UBYTE: f[0] = 66 #"B"
3314
* elif t == NPY_SHORT: f[0] = 104 #"h"
3315
* elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
3316
* elif t == NPY_INT: f[0] = 105 #"i"
3317
* elif t == NPY_UINT: f[0] = 73 #"I"
3319
__pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3320
__Pyx_GOTREF(__pyx_t_3);
3321
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3322
__Pyx_GOTREF(__pyx_t_5);
3323
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3324
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3325
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3327
(__pyx_v_f[0]) = 72;
3331
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":817
3332
* elif t == NPY_SHORT: f[0] = 104 #"h"
3333
* elif t == NPY_USHORT: f[0] = 72 #"H"
3334
* elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
3335
* elif t == NPY_UINT: f[0] = 73 #"I"
3336
* elif t == NPY_LONG: f[0] = 108 #"l"
3338
__pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3339
__Pyx_GOTREF(__pyx_t_5);
3340
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3341
__Pyx_GOTREF(__pyx_t_3);
3342
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3343
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3344
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3346
(__pyx_v_f[0]) = 105;
3350
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":818
3351
* elif t == NPY_USHORT: f[0] = 72 #"H"
3352
* elif t == NPY_INT: f[0] = 105 #"i"
3353
* elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
3354
* elif t == NPY_LONG: f[0] = 108 #"l"
3355
* elif t == NPY_ULONG: f[0] = 76 #"L"
3357
__pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3358
__Pyx_GOTREF(__pyx_t_3);
3359
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3360
__Pyx_GOTREF(__pyx_t_5);
3361
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3362
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3363
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3365
(__pyx_v_f[0]) = 73;
3369
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":819
3370
* elif t == NPY_INT: f[0] = 105 #"i"
3371
* elif t == NPY_UINT: f[0] = 73 #"I"
3372
* elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
3373
* elif t == NPY_ULONG: f[0] = 76 #"L"
3374
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3376
__pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3377
__Pyx_GOTREF(__pyx_t_5);
3378
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3379
__Pyx_GOTREF(__pyx_t_3);
3380
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3381
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3382
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3384
(__pyx_v_f[0]) = 108;
3388
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":820
3389
* elif t == NPY_UINT: f[0] = 73 #"I"
3390
* elif t == NPY_LONG: f[0] = 108 #"l"
3391
* elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
3392
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3393
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3395
__pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3396
__Pyx_GOTREF(__pyx_t_3);
3397
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3398
__Pyx_GOTREF(__pyx_t_5);
3399
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3400
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3401
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3403
(__pyx_v_f[0]) = 76;
3407
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":821
3408
* elif t == NPY_LONG: f[0] = 108 #"l"
3409
* elif t == NPY_ULONG: f[0] = 76 #"L"
3410
* elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
3411
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3412
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3414
__pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3415
__Pyx_GOTREF(__pyx_t_5);
3416
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3417
__Pyx_GOTREF(__pyx_t_3);
3418
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3419
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3420
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3422
(__pyx_v_f[0]) = 113;
3426
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":822
3427
* elif t == NPY_ULONG: f[0] = 76 #"L"
3428
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3429
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
3430
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3431
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3433
__pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3434
__Pyx_GOTREF(__pyx_t_3);
3435
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3436
__Pyx_GOTREF(__pyx_t_5);
3437
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3438
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3439
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3441
(__pyx_v_f[0]) = 81;
3445
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":823
3446
* elif t == NPY_LONGLONG: f[0] = 113 #"q"
3447
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3448
* elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
3449
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3450
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3452
__pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3453
__Pyx_GOTREF(__pyx_t_5);
3454
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3455
__Pyx_GOTREF(__pyx_t_3);
3456
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3457
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3458
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3460
(__pyx_v_f[0]) = 102;
3464
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":824
3465
* elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
3466
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3467
* elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
3468
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3469
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3471
__pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3472
__Pyx_GOTREF(__pyx_t_3);
3473
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3474
__Pyx_GOTREF(__pyx_t_5);
3475
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3476
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3477
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3479
(__pyx_v_f[0]) = 100;
3483
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":825
3484
* elif t == NPY_FLOAT: f[0] = 102 #"f"
3485
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3486
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
3487
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3488
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3490
__pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3491
__Pyx_GOTREF(__pyx_t_5);
3492
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3493
__Pyx_GOTREF(__pyx_t_3);
3494
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3495
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3496
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3498
(__pyx_v_f[0]) = 103;
3502
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":826
3503
* elif t == NPY_DOUBLE: f[0] = 100 #"d"
3504
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3505
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
3506
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3507
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
3509
__pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3510
__Pyx_GOTREF(__pyx_t_3);
3511
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3512
__Pyx_GOTREF(__pyx_t_5);
3513
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3514
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3515
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3517
(__pyx_v_f[0]) = 90;
3518
(__pyx_v_f[1]) = 102;
3523
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":827
3524
* elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
3525
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3526
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
3527
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
3528
* elif t == NPY_OBJECT: f[0] = 79 #"O"
3530
__pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3531
__Pyx_GOTREF(__pyx_t_5);
3532
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3533
__Pyx_GOTREF(__pyx_t_3);
3534
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3535
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3536
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3538
(__pyx_v_f[0]) = 90;
3539
(__pyx_v_f[1]) = 100;
3544
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":828
3545
* elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
3546
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3547
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
3548
* elif t == NPY_OBJECT: f[0] = 79 #"O"
3551
__pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3552
__Pyx_GOTREF(__pyx_t_3);
3553
__pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3554
__Pyx_GOTREF(__pyx_t_5);
3555
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3556
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3557
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3559
(__pyx_v_f[0]) = 90;
3560
(__pyx_v_f[1]) = 103;
3565
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":829
3566
* elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
3567
* elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
3568
* elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
3570
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
3572
__pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3573
__Pyx_GOTREF(__pyx_t_5);
3574
__pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3575
__Pyx_GOTREF(__pyx_t_3);
3576
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3577
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3578
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3580
(__pyx_v_f[0]) = 79;
3585
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":831
3586
* elif t == NPY_OBJECT: f[0] = 79 #"O"
3588
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
3592
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3593
__Pyx_GOTREF(__pyx_t_3);
3594
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3595
__Pyx_GOTREF(__pyx_t_5);
3596
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
3597
__Pyx_GIVEREF(__pyx_t_3);
3599
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3600
__Pyx_GOTREF(__pyx_t_3);
3601
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3602
__Pyx_Raise(__pyx_t_3, 0, 0);
3603
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3604
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3608
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":832
3610
* raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
3611
* f += 1 # <<<<<<<<<<<<<<
3613
* # Cython ignores struct boundary information ("T{...}"),
3620
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":836
3621
* # Cython ignores struct boundary information ("T{...}"),
3622
* # so don't output it
3623
* f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
3627
__pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3628
__pyx_v_f = __pyx_t_10;
3632
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3634
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":837
3635
* # so don't output it
3636
* f = _util_dtypestring(child, f, end, offset)
3637
* return f # <<<<<<<<<<<<<<
3641
__pyx_r = __pyx_v_f;
3647
__Pyx_XDECREF(__pyx_t_2);
3648
__Pyx_XDECREF(__pyx_t_3);
3649
__Pyx_XDECREF(__pyx_t_4);
3650
__Pyx_XDECREF(__pyx_t_5);
3651
__Pyx_AddTraceback("numpy._util_dtypestring");
3654
__Pyx_DECREF((PyObject *)__pyx_v_child);
3655
__Pyx_DECREF(__pyx_v_fields);
3656
__Pyx_DECREF(__pyx_v_childname);
3657
__Pyx_DECREF(__pyx_v_new_offset);
3658
__Pyx_DECREF(__pyx_v_t);
3659
__Pyx_DECREF((PyObject *)__pyx_v_descr);
3660
__Pyx_RefNannyFinishContext();
3664
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":952
3667
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
3668
* cdef PyObject* baseptr
3672
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
3673
PyObject *__pyx_v_baseptr;
3675
__Pyx_RefNannySetupContext("set_array_base");
3676
__Pyx_INCREF((PyObject *)__pyx_v_arr);
3677
__Pyx_INCREF(__pyx_v_base);
3679
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":954
3680
* cdef inline void set_array_base(ndarray arr, object base):
3681
* cdef PyObject* baseptr
3682
* if base is None: # <<<<<<<<<<<<<<
3686
__pyx_t_1 = (__pyx_v_base == Py_None);
3689
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":955
3690
* cdef PyObject* baseptr
3692
* baseptr = NULL # <<<<<<<<<<<<<<
3694
* Py_INCREF(base) # important to do this before decref below!
3696
__pyx_v_baseptr = NULL;
3701
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":957
3704
* Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
3705
* baseptr = <PyObject*>base
3706
* Py_XDECREF(arr.base)
3708
Py_INCREF(__pyx_v_base);
3710
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":958
3712
* Py_INCREF(base) # important to do this before decref below!
3713
* baseptr = <PyObject*>base # <<<<<<<<<<<<<<
3714
* Py_XDECREF(arr.base)
3715
* arr.base = baseptr
3717
__pyx_v_baseptr = ((PyObject *)__pyx_v_base);
3721
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":959
3722
* Py_INCREF(base) # important to do this before decref below!
3723
* baseptr = <PyObject*>base
3724
* Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
3725
* arr.base = baseptr
3728
Py_XDECREF(__pyx_v_arr->base);
3730
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":960
3731
* baseptr = <PyObject*>base
3732
* Py_XDECREF(arr.base)
3733
* arr.base = baseptr # <<<<<<<<<<<<<<
3735
* cdef inline object get_array_base(ndarray arr):
3737
__pyx_v_arr->base = __pyx_v_baseptr;
3739
__Pyx_DECREF((PyObject *)__pyx_v_arr);
3740
__Pyx_DECREF(__pyx_v_base);
3741
__Pyx_RefNannyFinishContext();
3744
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":962
3745
* arr.base = baseptr
3747
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
3748
* if arr.base is NULL:
3752
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
3753
PyObject *__pyx_r = NULL;
3755
__Pyx_RefNannySetupContext("get_array_base");
3756
__Pyx_INCREF((PyObject *)__pyx_v_arr);
3758
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":963
3760
* cdef inline object get_array_base(ndarray arr):
3761
* if arr.base is NULL: # <<<<<<<<<<<<<<
3765
__pyx_t_1 = (__pyx_v_arr->base == NULL);
3768
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":964
3769
* cdef inline object get_array_base(ndarray arr):
3770
* if arr.base is NULL:
3771
* return None # <<<<<<<<<<<<<<
3773
* return <object>arr.base
3775
__Pyx_XDECREF(__pyx_r);
3776
__Pyx_INCREF(Py_None);
3783
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/numpy.pxd":966
3786
* return <object>arr.base # <<<<<<<<<<<<<<
3788
__Pyx_XDECREF(__pyx_r);
3789
__Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
3790
__pyx_r = ((PyObject *)__pyx_v_arr->base);
3795
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
3797
__Pyx_DECREF((PyObject *)__pyx_v_arr);
3798
__Pyx_XGIVEREF(__pyx_r);
3799
__Pyx_RefNannyFinishContext();
3803
static struct PyMethodDef __pyx_methods[] = {
3804
{__Pyx_NAMESTR("goertzel_inner"), (PyCFunction)__pyx_pf_6cogent_5maths_7_period_goertzel_inner, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cogent_5maths_7_period_goertzel_inner)},
3805
{__Pyx_NAMESTR("ipdft_inner"), (PyCFunction)__pyx_pf_6cogent_5maths_7_period_ipdft_inner, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cogent_5maths_7_period_ipdft_inner)},
3806
{__Pyx_NAMESTR("autocorr_inner"), (PyCFunction)__pyx_pf_6cogent_5maths_7_period_autocorr_inner, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3807
{__Pyx_NAMESTR("seq_to_symbols"), (PyCFunction)__pyx_pf_6cogent_5maths_7_period_seq_to_symbols, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
3811
static void __pyx_init_filenames(void); /*proto*/
3813
#if PY_MAJOR_VERSION >= 3
3814
static struct PyModuleDef __pyx_moduledef = {
3815
PyModuleDef_HEAD_INIT,
3816
__Pyx_NAMESTR("_period"),
3819
__pyx_methods /* m_methods */,
3820
NULL, /* m_reload */
3821
NULL, /* m_traverse */
3827
static __Pyx_StringTabEntry __pyx_string_tab[] = {
3828
{&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
3829
{&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
3830
{&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
3831
{&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
3832
{&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
3833
{&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
3834
{&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
3835
{&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
3836
{&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1},
3837
{&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
3838
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
3839
{&__pyx_n_s__W, __pyx_k__W, sizeof(__pyx_k__W), 0, 0, 1, 1},
3840
{&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1},
3841
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
3842
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
3843
{&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
3844
{&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
3845
{&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1},
3846
{&__pyx_n_s__cos, __pyx_k__cos, sizeof(__pyx_k__cos), 0, 0, 1, 1},
3847
{&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1},
3848
{&__pyx_n_s__exp, __pyx_k__exp, sizeof(__pyx_k__exp), 0, 0, 1, 1},
3849
{&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
3850
{&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
3851
{&__pyx_n_s__goertzel_inner, __pyx_k__goertzel_inner, sizeof(__pyx_k__goertzel_inner), 0, 0, 1, 1},
3852
{&__pyx_n_s__ipdft_inner, __pyx_k__ipdft_inner, sizeof(__pyx_k__ipdft_inner), 0, 0, 1, 1},
3853
{&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
3854
{&__pyx_n_s__motif_length, __pyx_k__motif_length, sizeof(__pyx_k__motif_length), 0, 0, 1, 1},
3855
{&__pyx_n_s__motifs, __pyx_k__motifs, sizeof(__pyx_k__motifs), 0, 0, 1, 1},
3856
{&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1},
3857
{&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
3858
{&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
3859
{&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
3860
{&__pyx_n_s__period, __pyx_k__period, sizeof(__pyx_k__period), 0, 0, 1, 1},
3861
{&__pyx_n_s__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 0, 1, 1},
3862
{&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
3863
{&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1},
3864
{&__pyx_n_s__result, __pyx_k__result, sizeof(__pyx_k__result), 0, 0, 1, 1},
3865
{&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1},
3866
{&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
3867
{&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1},
3868
{&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1},
3869
{&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1},
3870
{&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1},
3871
{&__pyx_n_s__ulim, __pyx_k__ulim, sizeof(__pyx_k__ulim), 0, 0, 1, 1},
3872
{&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
3873
{&__pyx_n_s__xc, __pyx_k__xc, sizeof(__pyx_k__xc), 0, 0, 1, 1},
3874
{0, 0, 0, 0, 0, 0, 0}
3876
static int __Pyx_InitCachedBuiltins(void) {
3877
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3878
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3879
__pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3885
static int __Pyx_InitGlobals(void) {
3886
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3887
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3888
__pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3894
#if PY_MAJOR_VERSION < 3
3895
PyMODINIT_FUNC init_period(void); /*proto*/
3896
PyMODINIT_FUNC init_period(void)
3898
PyMODINIT_FUNC PyInit__period(void); /*proto*/
3899
PyMODINIT_FUNC PyInit__period(void)
3902
PyObject *__pyx_t_1 = NULL;
3903
PyObject *__pyx_t_2 = NULL;
3904
PyObject *__pyx_t_3 = NULL;
3906
void* __pyx_refnanny = NULL;
3907
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
3908
if (!__Pyx_RefNanny) {
3910
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
3911
if (!__Pyx_RefNanny)
3912
Py_FatalError("failed to import 'refnanny' module");
3914
__pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__period(void)", __LINE__, __FILE__);
3916
__pyx_init_filenames();
3917
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3918
#if PY_MAJOR_VERSION < 3
3919
__pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3921
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3923
/*--- Library function declarations ---*/
3924
/*--- Threads initialization code ---*/
3925
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
3926
#ifdef WITH_THREAD /* Python build with threading support? */
3927
PyEval_InitThreads();
3930
/*--- Module creation code ---*/
3931
#if PY_MAJOR_VERSION < 3
3932
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("_period"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
3934
__pyx_m = PyModule_Create(&__pyx_moduledef);
3936
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3937
#if PY_MAJOR_VERSION < 3
3940
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
3941
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3942
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3943
/*--- Initialize various global constants etc. ---*/
3944
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3945
if (__pyx_module_is_main_cogent__maths___period) {
3946
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
3948
/*--- Builtin init code ---*/
3949
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3950
/*--- Global init code ---*/
3951
/*--- Function export code ---*/
3952
/*--- Type init code ---*/
3953
/*--- Type import code ---*/
3954
__pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3955
__pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3956
__pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3957
__pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3958
__pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3959
/*--- Function import code ---*/
3960
/*--- Execution code ---*/
3962
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":1
3963
* from numpy import pi, exp, sqrt, cos # <<<<<<<<<<<<<<
3964
* cimport numpy as np
3967
__pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3968
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
3969
__Pyx_INCREF(((PyObject *)__pyx_n_s__pi));
3970
PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__pi));
3971
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__pi));
3972
__Pyx_INCREF(((PyObject *)__pyx_n_s__exp));
3973
PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__exp));
3974
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__exp));
3975
__Pyx_INCREF(((PyObject *)__pyx_n_s__sqrt));
3976
PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__sqrt));
3977
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__sqrt));
3978
__Pyx_INCREF(((PyObject *)__pyx_n_s__cos));
3979
PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__cos));
3980
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__cos));
3981
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3982
__Pyx_GOTREF(__pyx_t_2);
3983
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
3984
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3985
__Pyx_GOTREF(__pyx_t_1);
3986
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pi, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3987
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3988
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3989
__Pyx_GOTREF(__pyx_t_1);
3990
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__exp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3991
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3992
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3993
__Pyx_GOTREF(__pyx_t_1);
3994
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sqrt, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3995
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3996
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__cos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3997
__Pyx_GOTREF(__pyx_t_1);
3998
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cos, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3999
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4000
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4002
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":47
4003
* xc[m+N-1] += (x[n]*x[n-m])
4005
* def seq_to_symbols(char* seq, list motifs, int motif_length, # <<<<<<<<<<<<<<
4006
* np.ndarray[np.uint8_t, ndim=1] result):
4007
* cdef int i, j, N, num_motifs
4009
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4010
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
4012
/* "/Users/gavin/DevRepos/PyCogent-trunk/cogent/maths/_period.pyx":1
4013
* from numpy import pi, exp, sqrt, cos # <<<<<<<<<<<<<<
4014
* cimport numpy as np
4017
__pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__goertzel_inner); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4018
__Pyx_GOTREF(__pyx_t_1);
4019
__pyx_t_3 = __Pyx_GetAttrString(__pyx_t_1, "__doc__");
4020
__Pyx_GOTREF(__pyx_t_3);
4021
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4022
if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_7), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4023
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4024
__pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__ipdft_inner); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4025
__Pyx_GOTREF(__pyx_t_3);
4026
__pyx_t_1 = __Pyx_GetAttrString(__pyx_t_3, "__doc__");
4027
__Pyx_GOTREF(__pyx_t_1);
4028
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4029
if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_8), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4030
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4031
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4032
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
4034
/* "/Users/gavin/DevSandbox/trunk/lib/python2.6/site-packages/Cython-0.12.1-py2.6-macosx-10.6-universal.egg/Cython/Includes/stdlib.pxd":2
4036
* cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<<
4037
* void free(void *ptr)
4038
* void *malloc(size_t size)
4042
__Pyx_XDECREF(__pyx_t_1);
4043
__Pyx_XDECREF(__pyx_t_2);
4044
__Pyx_XDECREF(__pyx_t_3);
4046
__Pyx_AddTraceback("init cogent.maths._period");
4047
Py_DECREF(__pyx_m); __pyx_m = 0;
4048
} else if (!PyErr_Occurred()) {
4049
PyErr_SetString(PyExc_ImportError, "init cogent.maths._period");
4052
__Pyx_RefNannyFinishContext();
4053
#if PY_MAJOR_VERSION < 3
4060
static const char *__pyx_filenames[] = {
4065
/* Runtime support code */
4067
static void __pyx_init_filenames(void) {
4068
__pyx_f = __pyx_filenames;
4071
static void __Pyx_RaiseDoubleKeywordsError(
4072
const char* func_name,
4075
PyErr_Format(PyExc_TypeError,
4076
#if PY_MAJOR_VERSION >= 3
4077
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
4079
"%s() got multiple values for keyword argument '%s'", func_name,
4080
PyString_AS_STRING(kw_name));
4084
static void __Pyx_RaiseArgtupleInvalid(
4085
const char* func_name,
4089
Py_ssize_t num_found)
4091
Py_ssize_t num_expected;
4092
const char *number, *more_or_less;
4094
if (num_found < num_min) {
4095
num_expected = num_min;
4096
more_or_less = "at least";
4098
num_expected = num_max;
4099
more_or_less = "at most";
4102
more_or_less = "exactly";
4104
number = (num_expected == 1) ? "" : "s";
4105
PyErr_Format(PyExc_TypeError,
4106
#if PY_VERSION_HEX < 0x02050000
4107
"%s() takes %s %d positional argument%s (%d given)",
4109
"%s() takes %s %zd positional argument%s (%zd given)",
4111
func_name, more_or_less, num_expected, number, num_found);
4114
static int __Pyx_ParseOptionalKeywords(
4116
PyObject **argnames[],
4119
Py_ssize_t num_pos_args,
4120
const char* function_name)
4122
PyObject *key = 0, *value = 0;
4125
PyObject*** first_kw_arg = argnames + num_pos_args;
4127
while (PyDict_Next(kwds, &pos, &key, &value)) {
4128
name = first_kw_arg;
4129
while (*name && (**name != key)) name++;
4131
values[name-argnames] = value;
4133
#if PY_MAJOR_VERSION < 3
4134
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
4136
if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
4138
goto invalid_keyword_type;
4140
for (name = first_kw_arg; *name; name++) {
4141
#if PY_MAJOR_VERSION >= 3
4142
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
4143
PyUnicode_Compare(**name, key) == 0) break;
4145
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
4146
_PyString_Eq(**name, key)) break;
4150
values[name-argnames] = value;
4152
/* unexpected keyword found */
4153
for (name=argnames; name != first_kw_arg; name++) {
4154
if (**name == key) goto arg_passed_twice;
4155
#if PY_MAJOR_VERSION >= 3
4156
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
4157
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
4159
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
4160
_PyString_Eq(**name, key)) goto arg_passed_twice;
4164
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
4166
goto invalid_keyword;
4174
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
4176
invalid_keyword_type:
4177
PyErr_Format(PyExc_TypeError,
4178
"%s() keywords must be strings", function_name);
4181
PyErr_Format(PyExc_TypeError,
4182
#if PY_MAJOR_VERSION < 3
4183
"%s() got an unexpected keyword argument '%s'",
4184
function_name, PyString_AsString(key));
4186
"%s() got an unexpected keyword argument '%U'",
4187
function_name, key);
4193
static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
4195
return *(unsigned char*)(&n) != 0;
4199
__Pyx_StructField root;
4200
__Pyx_BufFmt_StackElem* head;
4202
int new_count, enc_count;
4206
} __Pyx_BufFmt_Context;
4208
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
4209
__Pyx_BufFmt_StackElem* stack,
4210
__Pyx_TypeInfo* type) {
4211
stack[0].field = &ctx->root;
4212
stack[0].parent_offset = 0;
4213
ctx->root.type = type;
4214
ctx->root.name = "buffer dtype";
4215
ctx->root.offset = 0;
4217
ctx->head->field = &ctx->root;
4218
ctx->fmt_offset = 0;
4219
ctx->head->parent_offset = 0;
4220
ctx->packmode = '@';
4224
ctx->is_complex = 0;
4225
while (type->typegroup == 'S') {
4227
ctx->head->field = type->fields;
4228
ctx->head->parent_offset = 0;
4229
type = type->fields->type;
4233
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
4235
const char* t = *ts;
4236
if (*t < '0' || *t > '9') {
4240
while (*t >= '0' && *t < '9') {
4242
count += *t++ - '0';
4249
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
4250
char msg[] = {ch, 0};
4251
PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg);
4254
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
4256
case 'b': return "'char'";
4257
case 'B': return "'unsigned char'";
4258
case 'h': return "'short'";
4259
case 'H': return "'unsigned short'";
4260
case 'i': return "'int'";
4261
case 'I': return "'unsigned int'";
4262
case 'l': return "'long'";
4263
case 'L': return "'unsigned long'";
4264
case 'q': return "'long long'";
4265
case 'Q': return "'unsigned long long'";
4266
case 'f': return (is_complex ? "'complex float'" : "'float'");
4267
case 'd': return (is_complex ? "'complex double'" : "'double'");
4268
case 'g': return (is_complex ? "'complex long double'" : "'long double'");
4269
case 'T': return "a struct";
4270
case 'O': return "Python object";
4271
case 'P': return "a pointer";
4272
case 0: return "end";
4273
default: return "unparseable format string";
4277
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
4279
case '?': case 'c': case 'b': case 'B': return 1;
4280
case 'h': case 'H': return 2;
4281
case 'i': case 'I': case 'l': case 'L': return 4;
4282
case 'q': case 'Q': return 8;
4283
case 'f': return (is_complex ? 8 : 4);
4284
case 'd': return (is_complex ? 16 : 8);
4286
PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
4289
case 'O': case 'P': return sizeof(void*);
4291
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
4296
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
4298
case 'c': case 'b': case 'B': return 1;
4299
case 'h': case 'H': return sizeof(short);
4300
case 'i': case 'I': return sizeof(int);
4301
case 'l': case 'L': return sizeof(long);
4302
#ifdef HAVE_LONG_LONG
4303
case 'q': case 'Q': return sizeof(PY_LONG_LONG);
4305
case 'f': return sizeof(float) * (is_complex ? 2 : 1);
4306
case 'd': return sizeof(double) * (is_complex ? 2 : 1);
4307
case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
4308
case 'O': case 'P': return sizeof(void*);
4310
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
4316
typedef struct { char c; short x; } __Pyx_st_short;
4317
typedef struct { char c; int x; } __Pyx_st_int;
4318
typedef struct { char c; long x; } __Pyx_st_long;
4319
typedef struct { char c; float x; } __Pyx_st_float;
4320
typedef struct { char c; double x; } __Pyx_st_double;
4321
typedef struct { char c; long double x; } __Pyx_st_longdouble;
4322
typedef struct { char c; void *x; } __Pyx_st_void_p;
4323
#ifdef HAVE_LONG_LONG
4324
typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long;
4327
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
4329
case '?': case 'c': case 'b': case 'B': return 1;
4330
case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
4331
case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
4332
case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
4333
#ifdef HAVE_LONG_LONG
4334
case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG);
4336
case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
4337
case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
4338
case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
4339
case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
4341
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
4346
static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
4348
case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I';
4349
case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U';
4350
case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R');
4351
case 'O': return 'O';
4352
case 'P': return 'P';
4354
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
4360
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
4361
if (ctx->head == NULL || ctx->head->field == &ctx->root) {
4362
const char* expected;
4364
if (ctx->head == NULL) {
4368
expected = ctx->head->field->type->name;
4371
PyErr_Format(PyExc_ValueError,
4372
"Buffer dtype mismatch, expected %s%s%s but got %s",
4373
quote, expected, quote,
4374
__Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
4376
__Pyx_StructField* field = ctx->head->field;
4377
__Pyx_StructField* parent = (ctx->head - 1)->field;
4378
PyErr_Format(PyExc_ValueError,
4379
"Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
4380
field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
4381
parent->type->name, field->name);
4385
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
4387
size_t size, offset;
4388
if (ctx->enc_type == 0) return 0;
4389
group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
4391
__Pyx_StructField* field = ctx->head->field;
4392
__Pyx_TypeInfo* type = field->type;
4394
if (ctx->packmode == '@' || ctx->packmode == '^') {
4395
size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
4397
size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
4399
if (ctx->packmode == '@') {
4400
int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
4401
int align_mod_offset;
4402
if (align_at == 0) return -1;
4403
align_mod_offset = ctx->fmt_offset % align_at;
4404
if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
4407
if (type->size != size || type->typegroup != group) {
4408
if (type->typegroup == 'C' && type->fields != NULL) {
4409
/* special case -- treat as struct rather than complex number */
4410
size_t parent_offset = ctx->head->parent_offset + field->offset;
4412
ctx->head->field = type->fields;
4413
ctx->head->parent_offset = parent_offset;
4417
__Pyx_BufFmt_RaiseExpected(ctx);
4421
offset = ctx->head->parent_offset + field->offset;
4422
if (ctx->fmt_offset != offset) {
4423
PyErr_Format(PyExc_ValueError,
4424
"Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d "
4425
"but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset);
4429
ctx->fmt_offset += size;
4431
--ctx->enc_count; /* Consume from buffer string */
4433
/* Done checking, move to next field, pushing or popping struct stack if needed */
4435
if (field == &ctx->root) {
4437
if (ctx->enc_count != 0) {
4438
__Pyx_BufFmt_RaiseExpected(ctx);
4441
break; /* breaks both loops as ctx->enc_count == 0 */
4443
ctx->head->field = ++field;
4444
if (field->type == NULL) {
4446
field = ctx->head->field;
4448
} else if (field->type->typegroup == 'S') {
4449
size_t parent_offset = ctx->head->parent_offset + field->offset;
4450
if (field->type->fields->type == NULL) continue; /* empty struct */
4451
field = field->type->fields;
4453
ctx->head->field = field;
4454
ctx->head->parent_offset = parent_offset;
4460
} while (ctx->enc_count);
4462
ctx->is_complex = 0;
4466
static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) {
4467
if (ctx->enc_type != 0 || ctx->packmode != '@') {
4468
PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)");
4474
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
4479
if (ctx->enc_type != 0 && ctx->head == NULL) {
4480
__Pyx_BufFmt_RaiseExpected(ctx);
4483
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
4484
if (ctx->head != NULL) {
4485
__Pyx_BufFmt_RaiseExpected(ctx);
4495
if (!__Pyx_IsLittleEndian()) {
4496
PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
4499
if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
4500
ctx->packmode = '=';
4505
if (__Pyx_IsLittleEndian()) {
4506
PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
4509
if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
4510
ctx->packmode = '=';
4516
if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
4517
ctx->packmode = *ts++;
4519
case 'T': /* substruct */
4522
const char* ts_after_sub;
4523
int struct_count = ctx->new_count;
4527
PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
4532
for (i = 0; i != struct_count; ++i) {
4533
ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
4534
if (!ts_after_sub) return NULL;
4539
case '}': /* end of substruct; either repeat or move on */
4543
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
4544
ctx->fmt_offset += ctx->new_count;
4553
if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
4554
__Pyx_BufFmt_RaiseUnexpectedChar('Z');
4556
} /* fall through */
4557
case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
4558
case 'l': case 'L': case 'q': case 'Q':
4559
case 'f': case 'd': case 'g':
4561
if (ctx->enc_type == *ts && got_Z == ctx->is_complex) {
4562
/* Continue pooling same type */
4563
ctx->enc_count += ctx->new_count;
4566
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
4567
ctx->enc_count = ctx->new_count;
4568
ctx->enc_type = *ts;
4569
ctx->is_complex = got_Z;
4577
ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts);
4578
if (ctx->new_count == -1) { /* First char was not a digit */
4579
char msg[2] = { *ts, 0 };
4580
PyErr_Format(PyExc_ValueError,
4581
"Does not understand character buffer dtype format string ('%s')", msg);
4590
static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
4593
buf->strides = __Pyx_zeros;
4594
buf->shape = __Pyx_zeros;
4595
buf->suboffsets = __Pyx_minusones;
4598
static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) {
4599
if (obj == Py_None) {
4600
__Pyx_ZeroBuffer(buf);
4604
if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
4605
if (buf->ndim != nd) {
4606
PyErr_Format(PyExc_ValueError,
4607
"Buffer has wrong number of dimensions (expected %d, got %d)",
4612
__Pyx_BufFmt_Context ctx;
4613
__Pyx_BufFmt_Init(&ctx, stack, dtype);
4614
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
4616
if ((unsigned)buf->itemsize != dtype->size) {
4617
PyErr_Format(PyExc_ValueError,
4618
"Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
4619
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
4621
dtype->size, (dtype->size > 1) ? "s" : "");
4624
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
4627
__Pyx_ZeroBuffer(buf);
4631
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
4632
if (info->buf == NULL) return;
4633
if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
4634
__Pyx_ReleaseBuffer(info);
4636
static void __Pyx_RaiseBufferIndexError(int axis) {
4637
PyErr_Format(PyExc_IndexError,
4638
"Out of bounds on buffer access (axis %d)", axis);
4642
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
4643
PyObject *tmp_type, *tmp_value, *tmp_tb;
4644
PyThreadState *tstate = PyThreadState_GET();
4646
tmp_type = tstate->curexc_type;
4647
tmp_value = tstate->curexc_value;
4648
tmp_tb = tstate->curexc_traceback;
4649
tstate->curexc_type = type;
4650
tstate->curexc_value = value;
4651
tstate->curexc_traceback = tb;
4652
Py_XDECREF(tmp_type);
4653
Py_XDECREF(tmp_value);
4657
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
4658
PyThreadState *tstate = PyThreadState_GET();
4659
*type = tstate->curexc_type;
4660
*value = tstate->curexc_value;
4661
*tb = tstate->curexc_traceback;
4663
tstate->curexc_type = 0;
4664
tstate->curexc_value = 0;
4665
tstate->curexc_traceback = 0;
4670
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
4671
PyErr_Format(PyExc_ValueError,
4672
#if PY_VERSION_HEX < 0x02050000
4673
"need more than %d value%s to unpack", (int)index,
4675
"need more than %zd value%s to unpack", index,
4677
(index == 1) ? "" : "s");
4680
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) {
4681
PyErr_SetString(PyExc_ValueError, "too many values to unpack");
4684
static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
4686
if (!(item = PyIter_Next(iter))) {
4687
if (!PyErr_Occurred()) {
4688
__Pyx_RaiseNeedMoreValuesError(index);
4694
static int __Pyx_EndUnpack(PyObject *iter) {
4696
if ((item = PyIter_Next(iter))) {
4698
__Pyx_RaiseTooManyValuesError();
4701
else if (!PyErr_Occurred())
4707
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
4708
if (unlikely(!type)) {
4709
PyErr_Format(PyExc_SystemError, "Missing type object");
4712
if (likely(PyObject_TypeCheck(obj, type)))
4714
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
4715
Py_TYPE(obj)->tp_name, type->tp_name);
4719
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
4720
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
4723
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
4725
__Pyx_RaiseNoneNotIterableError();
4726
} else if (PyTuple_GET_SIZE(t) < index) {
4727
__Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
4729
__Pyx_RaiseTooManyValuesError();
4733
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
4734
const char *name, int exact)
4737
PyErr_Format(PyExc_SystemError, "Missing type object");
4740
if (none_allowed && obj == Py_None) return 1;
4742
if (Py_TYPE(obj) == type) return 1;
4745
if (PyObject_TypeCheck(obj, type)) return 1;
4747
PyErr_Format(PyExc_TypeError,
4748
"Argument '%s' has incorrect type (expected %s, got %s)",
4749
name, type->tp_name, Py_TYPE(obj)->tp_name);
4753
#if PY_MAJOR_VERSION < 3
4754
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
4755
#if PY_VERSION_HEX >= 0x02060000
4756
if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER)
4757
return PyObject_GetBuffer(obj, view, flags);
4759
if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
4761
PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
4766
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
4767
PyObject* obj = view->obj;
4769
if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view);
4777
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
4778
PyObject *__import__ = 0;
4779
PyObject *empty_list = 0;
4780
PyObject *module = 0;
4781
PyObject *global_dict = 0;
4782
PyObject *empty_dict = 0;
4784
__import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
4790
empty_list = PyList_New(0);
4795
global_dict = PyModule_GetDict(__pyx_m);
4798
empty_dict = PyDict_New();
4801
module = PyObject_CallFunctionObjArgs(__import__,
4802
name, global_dict, empty_dict, list, NULL);
4804
Py_XDECREF(empty_list);
4805
Py_XDECREF(__import__);
4806
Py_XDECREF(empty_dict);
4810
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
4812
result = PyObject_GetAttr(dict, name);
4814
PyErr_SetObject(PyExc_NameError, name);
4820
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
4821
return ::std::complex< double >(x, y);
4824
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
4825
return x + y*(__pyx_t_double_complex)_Complex_I;
4829
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
4830
__pyx_t_double_complex z;
4839
static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4840
return (a.real == b.real) && (a.imag == b.imag);
4842
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4843
__pyx_t_double_complex z;
4844
z.real = a.real + b.real;
4845
z.imag = a.imag + b.imag;
4848
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4849
__pyx_t_double_complex z;
4850
z.real = a.real - b.real;
4851
z.imag = a.imag - b.imag;
4854
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4855
__pyx_t_double_complex z;
4856
z.real = a.real * b.real - a.imag * b.imag;
4857
z.imag = a.real * b.imag + a.imag * b.real;
4860
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
4861
__pyx_t_double_complex z;
4862
double denom = b.real * b.real + b.imag * b.imag;
4863
z.real = (a.real * b.real + a.imag * b.imag) / denom;
4864
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
4867
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
4868
__pyx_t_double_complex z;
4873
static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
4874
return (a.real == 0) && (a.imag == 0);
4876
static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
4877
__pyx_t_double_complex z;
4883
static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
4885
return hypot(z.real, z.imag);
4887
return sqrt(z.real*z.real + z.imag*z.imag);
4895
static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64 x, npy_float64 y) {
4896
return ::std::complex< npy_float64 >(x, y);
4899
static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64 x, npy_float64 y) {
4900
return x + y*(__pyx_t_npy_float64_complex)_Complex_I;
4904
static CYTHON_INLINE __pyx_t_npy_float64_complex __pyx_t_npy_float64_complex_from_parts(npy_float64 x, npy_float64 y) {
4905
__pyx_t_npy_float64_complex z;
4914
static CYTHON_INLINE int __Pyx_c_eq_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) {
4915
return (a.real == b.real) && (a.imag == b.imag);
4917
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_sum_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) {
4918
__pyx_t_npy_float64_complex z;
4919
z.real = a.real + b.real;
4920
z.imag = a.imag + b.imag;
4923
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_diff_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) {
4924
__pyx_t_npy_float64_complex z;
4925
z.real = a.real - b.real;
4926
z.imag = a.imag - b.imag;
4929
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_prod_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) {
4930
__pyx_t_npy_float64_complex z;
4931
z.real = a.real * b.real - a.imag * b.imag;
4932
z.imag = a.real * b.imag + a.imag * b.real;
4935
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_quot_npy_float64(__pyx_t_npy_float64_complex a, __pyx_t_npy_float64_complex b) {
4936
__pyx_t_npy_float64_complex z;
4937
npy_float64 denom = b.real * b.real + b.imag * b.imag;
4938
z.real = (a.real * b.real + a.imag * b.imag) / denom;
4939
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
4942
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_neg_npy_float64(__pyx_t_npy_float64_complex a) {
4943
__pyx_t_npy_float64_complex z;
4948
static CYTHON_INLINE int __Pyx_c_is_zero_npy_float64(__pyx_t_npy_float64_complex a) {
4949
return (a.real == 0) && (a.imag == 0);
4951
static CYTHON_INLINE __pyx_t_npy_float64_complex __Pyx_c_conj_npy_float64(__pyx_t_npy_float64_complex a) {
4952
__pyx_t_npy_float64_complex z;
4958
static CYTHON_INLINE npy_float64 __Pyx_c_abs_npy_float64(__pyx_t_npy_float64_complex z) {
4960
return hypot_npy_float64(z.real, z.imag);
4962
return sqrt_npy_float64(z.real*z.real + z.imag*z.imag);
4970
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
4971
return ::std::complex< float >(x, y);
4974
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
4975
return x + y*(__pyx_t_float_complex)_Complex_I;
4979
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
4980
__pyx_t_float_complex z;
4989
static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4990
return (a.real == b.real) && (a.imag == b.imag);
4992
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4993
__pyx_t_float_complex z;
4994
z.real = a.real + b.real;
4995
z.imag = a.imag + b.imag;
4998
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
4999
__pyx_t_float_complex z;
5000
z.real = a.real - b.real;
5001
z.imag = a.imag - b.imag;
5004
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5005
__pyx_t_float_complex z;
5006
z.real = a.real * b.real - a.imag * b.imag;
5007
z.imag = a.real * b.imag + a.imag * b.real;
5010
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
5011
__pyx_t_float_complex z;
5012
float denom = b.real * b.real + b.imag * b.imag;
5013
z.real = (a.real * b.real + a.imag * b.imag) / denom;
5014
z.imag = (a.imag * b.real - a.real * b.imag) / denom;
5017
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
5018
__pyx_t_float_complex z;
5023
static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
5024
return (a.real == 0) && (a.imag == 0);
5026
static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
5027
__pyx_t_float_complex z;
5033
static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
5035
return hypotf(z.real, z.imag);
5037
return sqrtf(z.real*z.real + z.imag*z.imag);
5043
#if PY_MAJOR_VERSION < 3
5044
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
5048
/* First, check the traceback argument, replacing None with NULL. */
5049
if (tb == Py_None) {
5053
else if (tb != NULL && !PyTraceBack_Check(tb)) {
5054
PyErr_SetString(PyExc_TypeError,
5055
"raise: arg 3 must be a traceback or None");
5058
/* Next, replace a missing value with None */
5059
if (value == NULL) {
5063
#if PY_VERSION_HEX < 0x02050000
5064
if (!PyClass_Check(type))
5066
if (!PyType_Check(type))
5069
/* Raising an instance. The value should be a dummy. */
5070
if (value != Py_None) {
5071
PyErr_SetString(PyExc_TypeError,
5072
"instance exception may not have a separate value");
5075
/* Normalize to raise <class>, <instance> */
5078
#if PY_VERSION_HEX < 0x02050000
5079
if (PyInstance_Check(type)) {
5080
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
5085
PyErr_SetString(PyExc_TypeError,
5086
"raise: exception must be an old-style class or instance");
5090
type = (PyObject*) Py_TYPE(type);
5092
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
5093
PyErr_SetString(PyExc_TypeError,
5094
"raise: exception class must be a subclass of BaseException");
5100
__Pyx_ErrRestore(type, value, tb);
5109
#else /* Python 3+ */
5111
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
5112
if (tb == Py_None) {
5114
} else if (tb && !PyTraceBack_Check(tb)) {
5115
PyErr_SetString(PyExc_TypeError,
5116
"raise: arg 3 must be a traceback or None");
5119
if (value == Py_None)
5122
if (PyExceptionInstance_Check(type)) {
5124
PyErr_SetString(PyExc_TypeError,
5125
"instance exception may not have a separate value");
5129
type = (PyObject*) Py_TYPE(value);
5130
} else if (!PyExceptionClass_Check(type)) {
5131
PyErr_SetString(PyExc_TypeError,
5132
"raise: exception class must be a subclass of BaseException");
5136
PyErr_SetObject(type, value);
5139
PyThreadState *tstate = PyThreadState_GET();
5140
PyObject* tmp_tb = tstate->curexc_traceback;
5143
tstate->curexc_traceback = tb;
5153
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
5154
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
5155
const int is_unsigned = neg_one > const_zero;
5156
if (sizeof(unsigned char) < sizeof(long)) {
5157
long val = __Pyx_PyInt_AsLong(x);
5158
if (unlikely(val != (long)(unsigned char)val)) {
5159
if (!unlikely(val == -1 && PyErr_Occurred())) {
5160
PyErr_SetString(PyExc_OverflowError,
5161
(is_unsigned && unlikely(val < 0)) ?
5162
"can't convert negative value to unsigned char" :
5163
"value too large to convert to unsigned char");
5165
return (unsigned char)-1;
5167
return (unsigned char)val;
5169
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
5172
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
5173
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
5174
const int is_unsigned = neg_one > const_zero;
5175
if (sizeof(unsigned short) < sizeof(long)) {
5176
long val = __Pyx_PyInt_AsLong(x);
5177
if (unlikely(val != (long)(unsigned short)val)) {
5178
if (!unlikely(val == -1 && PyErr_Occurred())) {
5179
PyErr_SetString(PyExc_OverflowError,
5180
(is_unsigned && unlikely(val < 0)) ?
5181
"can't convert negative value to unsigned short" :
5182
"value too large to convert to unsigned short");
5184
return (unsigned short)-1;
5186
return (unsigned short)val;
5188
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
5191
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
5192
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
5193
const int is_unsigned = neg_one > const_zero;
5194
if (sizeof(unsigned int) < sizeof(long)) {
5195
long val = __Pyx_PyInt_AsLong(x);
5196
if (unlikely(val != (long)(unsigned int)val)) {
5197
if (!unlikely(val == -1 && PyErr_Occurred())) {
5198
PyErr_SetString(PyExc_OverflowError,
5199
(is_unsigned && unlikely(val < 0)) ?
5200
"can't convert negative value to unsigned int" :
5201
"value too large to convert to unsigned int");
5203
return (unsigned int)-1;
5205
return (unsigned int)val;
5207
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
5210
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
5211
const char neg_one = (char)-1, const_zero = 0;
5212
const int is_unsigned = neg_one > const_zero;
5213
if (sizeof(char) < sizeof(long)) {
5214
long val = __Pyx_PyInt_AsLong(x);
5215
if (unlikely(val != (long)(char)val)) {
5216
if (!unlikely(val == -1 && PyErr_Occurred())) {
5217
PyErr_SetString(PyExc_OverflowError,
5218
(is_unsigned && unlikely(val < 0)) ?
5219
"can't convert negative value to char" :
5220
"value too large to convert to char");
5226
return (char)__Pyx_PyInt_AsLong(x);
5229
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
5230
const short neg_one = (short)-1, const_zero = 0;
5231
const int is_unsigned = neg_one > const_zero;
5232
if (sizeof(short) < sizeof(long)) {
5233
long val = __Pyx_PyInt_AsLong(x);
5234
if (unlikely(val != (long)(short)val)) {
5235
if (!unlikely(val == -1 && PyErr_Occurred())) {
5236
PyErr_SetString(PyExc_OverflowError,
5237
(is_unsigned && unlikely(val < 0)) ?
5238
"can't convert negative value to short" :
5239
"value too large to convert to short");
5245
return (short)__Pyx_PyInt_AsLong(x);
5248
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
5249
const int neg_one = (int)-1, const_zero = 0;
5250
const int is_unsigned = neg_one > const_zero;
5251
if (sizeof(int) < sizeof(long)) {
5252
long val = __Pyx_PyInt_AsLong(x);
5253
if (unlikely(val != (long)(int)val)) {
5254
if (!unlikely(val == -1 && PyErr_Occurred())) {
5255
PyErr_SetString(PyExc_OverflowError,
5256
(is_unsigned && unlikely(val < 0)) ?
5257
"can't convert negative value to int" :
5258
"value too large to convert to int");
5264
return (int)__Pyx_PyInt_AsLong(x);
5267
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
5268
const signed char neg_one = (signed char)-1, const_zero = 0;
5269
const int is_unsigned = neg_one > const_zero;
5270
if (sizeof(signed char) < sizeof(long)) {
5271
long val = __Pyx_PyInt_AsLong(x);
5272
if (unlikely(val != (long)(signed char)val)) {
5273
if (!unlikely(val == -1 && PyErr_Occurred())) {
5274
PyErr_SetString(PyExc_OverflowError,
5275
(is_unsigned && unlikely(val < 0)) ?
5276
"can't convert negative value to signed char" :
5277
"value too large to convert to signed char");
5279
return (signed char)-1;
5281
return (signed char)val;
5283
return (signed char)__Pyx_PyInt_AsSignedLong(x);
5286
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
5287
const signed short neg_one = (signed short)-1, const_zero = 0;
5288
const int is_unsigned = neg_one > const_zero;
5289
if (sizeof(signed short) < sizeof(long)) {
5290
long val = __Pyx_PyInt_AsLong(x);
5291
if (unlikely(val != (long)(signed short)val)) {
5292
if (!unlikely(val == -1 && PyErr_Occurred())) {
5293
PyErr_SetString(PyExc_OverflowError,
5294
(is_unsigned && unlikely(val < 0)) ?
5295
"can't convert negative value to signed short" :
5296
"value too large to convert to signed short");
5298
return (signed short)-1;
5300
return (signed short)val;
5302
return (signed short)__Pyx_PyInt_AsSignedLong(x);
5305
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
5306
const signed int neg_one = (signed int)-1, const_zero = 0;
5307
const int is_unsigned = neg_one > const_zero;
5308
if (sizeof(signed int) < sizeof(long)) {
5309
long val = __Pyx_PyInt_AsLong(x);
5310
if (unlikely(val != (long)(signed int)val)) {
5311
if (!unlikely(val == -1 && PyErr_Occurred())) {
5312
PyErr_SetString(PyExc_OverflowError,
5313
(is_unsigned && unlikely(val < 0)) ?
5314
"can't convert negative value to signed int" :
5315
"value too large to convert to signed int");
5317
return (signed int)-1;
5319
return (signed int)val;
5321
return (signed int)__Pyx_PyInt_AsSignedLong(x);
5324
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
5325
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
5326
const int is_unsigned = neg_one > const_zero;
5327
#if PY_VERSION_HEX < 0x03000000
5328
if (likely(PyInt_Check(x))) {
5329
long val = PyInt_AS_LONG(x);
5330
if (is_unsigned && unlikely(val < 0)) {
5331
PyErr_SetString(PyExc_OverflowError,
5332
"can't convert negative value to unsigned long");
5333
return (unsigned long)-1;
5335
return (unsigned long)val;
5338
if (likely(PyLong_Check(x))) {
5340
if (unlikely(Py_SIZE(x) < 0)) {
5341
PyErr_SetString(PyExc_OverflowError,
5342
"can't convert negative value to unsigned long");
5343
return (unsigned long)-1;
5345
return PyLong_AsUnsignedLong(x);
5347
return PyLong_AsLong(x);
5351
PyObject *tmp = __Pyx_PyNumber_Int(x);
5352
if (!tmp) return (unsigned long)-1;
5353
val = __Pyx_PyInt_AsUnsignedLong(tmp);
5359
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
5360
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
5361
const int is_unsigned = neg_one > const_zero;
5362
#if PY_VERSION_HEX < 0x03000000
5363
if (likely(PyInt_Check(x))) {
5364
long val = PyInt_AS_LONG(x);
5365
if (is_unsigned && unlikely(val < 0)) {
5366
PyErr_SetString(PyExc_OverflowError,
5367
"can't convert negative value to unsigned PY_LONG_LONG");
5368
return (unsigned PY_LONG_LONG)-1;
5370
return (unsigned PY_LONG_LONG)val;
5373
if (likely(PyLong_Check(x))) {
5375
if (unlikely(Py_SIZE(x) < 0)) {
5376
PyErr_SetString(PyExc_OverflowError,
5377
"can't convert negative value to unsigned PY_LONG_LONG");
5378
return (unsigned PY_LONG_LONG)-1;
5380
return PyLong_AsUnsignedLongLong(x);
5382
return PyLong_AsLongLong(x);
5385
unsigned PY_LONG_LONG val;
5386
PyObject *tmp = __Pyx_PyNumber_Int(x);
5387
if (!tmp) return (unsigned PY_LONG_LONG)-1;
5388
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
5394
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
5395
const long neg_one = (long)-1, const_zero = 0;
5396
const int is_unsigned = neg_one > const_zero;
5397
#if PY_VERSION_HEX < 0x03000000
5398
if (likely(PyInt_Check(x))) {
5399
long val = PyInt_AS_LONG(x);
5400
if (is_unsigned && unlikely(val < 0)) {
5401
PyErr_SetString(PyExc_OverflowError,
5402
"can't convert negative value to long");
5408
if (likely(PyLong_Check(x))) {
5410
if (unlikely(Py_SIZE(x) < 0)) {
5411
PyErr_SetString(PyExc_OverflowError,
5412
"can't convert negative value to long");
5415
return PyLong_AsUnsignedLong(x);
5417
return PyLong_AsLong(x);
5421
PyObject *tmp = __Pyx_PyNumber_Int(x);
5422
if (!tmp) return (long)-1;
5423
val = __Pyx_PyInt_AsLong(tmp);
5429
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
5430
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
5431
const int is_unsigned = neg_one > const_zero;
5432
#if PY_VERSION_HEX < 0x03000000
5433
if (likely(PyInt_Check(x))) {
5434
long val = PyInt_AS_LONG(x);
5435
if (is_unsigned && unlikely(val < 0)) {
5436
PyErr_SetString(PyExc_OverflowError,
5437
"can't convert negative value to PY_LONG_LONG");
5438
return (PY_LONG_LONG)-1;
5440
return (PY_LONG_LONG)val;
5443
if (likely(PyLong_Check(x))) {
5445
if (unlikely(Py_SIZE(x) < 0)) {
5446
PyErr_SetString(PyExc_OverflowError,
5447
"can't convert negative value to PY_LONG_LONG");
5448
return (PY_LONG_LONG)-1;
5450
return PyLong_AsUnsignedLongLong(x);
5452
return PyLong_AsLongLong(x);
5456
PyObject *tmp = __Pyx_PyNumber_Int(x);
5457
if (!tmp) return (PY_LONG_LONG)-1;
5458
val = __Pyx_PyInt_AsLongLong(tmp);
5464
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
5465
const signed long neg_one = (signed long)-1, const_zero = 0;
5466
const int is_unsigned = neg_one > const_zero;
5467
#if PY_VERSION_HEX < 0x03000000
5468
if (likely(PyInt_Check(x))) {
5469
long val = PyInt_AS_LONG(x);
5470
if (is_unsigned && unlikely(val < 0)) {
5471
PyErr_SetString(PyExc_OverflowError,
5472
"can't convert negative value to signed long");
5473
return (signed long)-1;
5475
return (signed long)val;
5478
if (likely(PyLong_Check(x))) {
5480
if (unlikely(Py_SIZE(x) < 0)) {
5481
PyErr_SetString(PyExc_OverflowError,
5482
"can't convert negative value to signed long");
5483
return (signed long)-1;
5485
return PyLong_AsUnsignedLong(x);
5487
return PyLong_AsLong(x);
5491
PyObject *tmp = __Pyx_PyNumber_Int(x);
5492
if (!tmp) return (signed long)-1;
5493
val = __Pyx_PyInt_AsSignedLong(tmp);
5499
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
5500
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
5501
const int is_unsigned = neg_one > const_zero;
5502
#if PY_VERSION_HEX < 0x03000000
5503
if (likely(PyInt_Check(x))) {
5504
long val = PyInt_AS_LONG(x);
5505
if (is_unsigned && unlikely(val < 0)) {
5506
PyErr_SetString(PyExc_OverflowError,
5507
"can't convert negative value to signed PY_LONG_LONG");
5508
return (signed PY_LONG_LONG)-1;
5510
return (signed PY_LONG_LONG)val;
5513
if (likely(PyLong_Check(x))) {
5515
if (unlikely(Py_SIZE(x) < 0)) {
5516
PyErr_SetString(PyExc_OverflowError,
5517
"can't convert negative value to signed PY_LONG_LONG");
5518
return (signed PY_LONG_LONG)-1;
5520
return PyLong_AsUnsignedLongLong(x);
5522
return PyLong_AsLongLong(x);
5525
signed PY_LONG_LONG val;
5526
PyObject *tmp = __Pyx_PyNumber_Int(x);
5527
if (!tmp) return (signed PY_LONG_LONG)-1;
5528
val = __Pyx_PyInt_AsSignedLongLong(tmp);
5534
#ifndef __PYX_HAVE_RT_ImportType
5535
#define __PYX_HAVE_RT_ImportType
5536
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
5537
long size, int strict)
5539
PyObject *py_module = 0;
5540
PyObject *result = 0;
5541
PyObject *py_name = 0;
5544
py_module = __Pyx_ImportModule(module_name);
5547
#if PY_MAJOR_VERSION < 3
5548
py_name = PyString_FromString(class_name);
5550
py_name = PyUnicode_FromString(class_name);
5554
result = PyObject_GetAttr(py_module, py_name);
5557
Py_DECREF(py_module);
5561
if (!PyType_Check(result)) {
5562
PyErr_Format(PyExc_TypeError,
5563
"%s.%s is not a type object",
5564
module_name, class_name);
5567
if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
5568
PyOS_snprintf(warning, sizeof(warning),
5569
"%s.%s size changed, may indicate binary incompatibility",
5570
module_name, class_name);
5571
PyErr_WarnEx(NULL, warning, 0);
5573
else if (((PyTypeObject *)result)->tp_basicsize != size) {
5574
PyErr_Format(PyExc_ValueError,
5575
"%s.%s has the wrong size, try recompiling",
5576
module_name, class_name);
5579
return (PyTypeObject *)result;
5581
Py_XDECREF(py_module);
5587
#ifndef __PYX_HAVE_RT_ImportModule
5588
#define __PYX_HAVE_RT_ImportModule
5589
static PyObject *__Pyx_ImportModule(const char *name) {
5590
PyObject *py_name = 0;
5591
PyObject *py_module = 0;
5593
#if PY_MAJOR_VERSION < 3
5594
py_name = PyString_FromString(name);
5596
py_name = PyUnicode_FromString(name);
5600
py_module = PyImport_Import(py_name);
5604
Py_XDECREF(py_name);
5609
#include "compile.h"
5610
#include "frameobject.h"
5611
#include "traceback.h"
5613
static void __Pyx_AddTraceback(const char *funcname) {
5614
PyObject *py_srcfile = 0;
5615
PyObject *py_funcname = 0;
5616
PyObject *py_globals = 0;
5617
PyCodeObject *py_code = 0;
5618
PyFrameObject *py_frame = 0;
5620
#if PY_MAJOR_VERSION < 3
5621
py_srcfile = PyString_FromString(__pyx_filename);
5623
py_srcfile = PyUnicode_FromString(__pyx_filename);
5625
if (!py_srcfile) goto bad;
5626
if (__pyx_clineno) {
5627
#if PY_MAJOR_VERSION < 3
5628
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
5630
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
5634
#if PY_MAJOR_VERSION < 3
5635
py_funcname = PyString_FromString(funcname);
5637
py_funcname = PyUnicode_FromString(funcname);
5640
if (!py_funcname) goto bad;
5641
py_globals = PyModule_GetDict(__pyx_m);
5642
if (!py_globals) goto bad;
5643
py_code = PyCode_New(
5644
0, /*int argcount,*/
5645
#if PY_MAJOR_VERSION >= 3
5646
0, /*int kwonlyargcount,*/
5649
0, /*int stacksize,*/
5651
__pyx_empty_bytes, /*PyObject *code,*/
5652
__pyx_empty_tuple, /*PyObject *consts,*/
5653
__pyx_empty_tuple, /*PyObject *names,*/
5654
__pyx_empty_tuple, /*PyObject *varnames,*/
5655
__pyx_empty_tuple, /*PyObject *freevars,*/
5656
__pyx_empty_tuple, /*PyObject *cellvars,*/
5657
py_srcfile, /*PyObject *filename,*/
5658
py_funcname, /*PyObject *name,*/
5659
__pyx_lineno, /*int firstlineno,*/
5660
__pyx_empty_bytes /*PyObject *lnotab*/
5662
if (!py_code) goto bad;
5663
py_frame = PyFrame_New(
5664
PyThreadState_GET(), /*PyThreadState *tstate,*/
5665
py_code, /*PyCodeObject *code,*/
5666
py_globals, /*PyObject *globals,*/
5667
0 /*PyObject *locals*/
5669
if (!py_frame) goto bad;
5670
py_frame->f_lineno = __pyx_lineno;
5671
PyTraceBack_Here(py_frame);
5673
Py_XDECREF(py_srcfile);
5674
Py_XDECREF(py_funcname);
5675
Py_XDECREF(py_code);
5676
Py_XDECREF(py_frame);
5679
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
5681
#if PY_MAJOR_VERSION < 3
5682
if (t->is_unicode) {
5683
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
5684
} else if (t->intern) {
5685
*t->p = PyString_InternFromString(t->s);
5687
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
5689
#else /* Python 3+ has unicode identifiers */
5690
if (t->is_unicode | t->is_str) {
5692
*t->p = PyUnicode_InternFromString(t->s);
5693
} else if (t->encoding) {
5694
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
5696
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
5699
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
5709
/* Type Conversion Functions */
5711
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
5712
if (x == Py_True) return 1;
5713
else if ((x == Py_False) | (x == Py_None)) return 0;
5714
else return PyObject_IsTrue(x);
5717
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
5719
const char *name = NULL;
5720
PyObject *res = NULL;
5721
#if PY_VERSION_HEX < 0x03000000
5722
if (PyInt_Check(x) || PyLong_Check(x))
5724
if (PyLong_Check(x))
5726
return Py_INCREF(x), x;
5727
m = Py_TYPE(x)->tp_as_number;
5728
#if PY_VERSION_HEX < 0x03000000
5729
if (m && m->nb_int) {
5731
res = PyNumber_Int(x);
5733
else if (m && m->nb_long) {
5735
res = PyNumber_Long(x);
5738
if (m && m->nb_int) {
5740
res = PyNumber_Long(x);
5744
#if PY_VERSION_HEX < 0x03000000
5745
if (!PyInt_Check(res) && !PyLong_Check(res)) {
5747
if (!PyLong_Check(res)) {
5749
PyErr_Format(PyExc_TypeError,
5750
"__%s__ returned non-%s (type %.200s)",
5751
name, name, Py_TYPE(res)->tp_name);
5756
else if (!PyErr_Occurred()) {
5757
PyErr_SetString(PyExc_TypeError,
5758
"an integer is required");
5763
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
5765
PyObject* x = PyNumber_Index(b);
5767
ival = PyInt_AsSsize_t(x);
5772
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
5773
#if PY_VERSION_HEX < 0x02050000
5774
if (ival <= LONG_MAX)
5775
return PyInt_FromLong((long)ival);
5777
unsigned char *bytes = (unsigned char *) &ival;
5778
int one = 1; int little = (int)*(unsigned char*)&one;
5779
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
5782
return PyInt_FromSize_t(ival);
5786
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
5787
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
5788
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
5790
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
5791
PyErr_SetString(PyExc_OverflowError,
5792
"value too large to convert to size_t");
5799
#endif /* Py_PYTHON_H */